< Summary

Class:Azure.ResourceManager.Compute.VirtualMachinesOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachinesOperations.cs
Covered lines:226
Uncovered lines:326
Coverable lines:552
Total lines:1362
Line coverage:40.9% (226 of 552)
Covered branches:48
Total branches:144
Branch coverage:33.3% (48 of 144)

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%
InstanceViewAsync()-57.14%100%
InstanceView(...)-57.14%100%
GeneralizeAsync()-0%100%
Generalize(...)-0%100%
SimulateEvictionAsync()-57.14%100%
SimulateEviction(...)-57.14%100%
ListByLocationAsync(...)-36.84%50%
<ListByLocationAsync()-62.5%100%
<ListByLocationAsync()-0%100%
ListByLocation(...)-36.84%50%
ListAsync(...)-36.84%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
List(...)-36.84%50%
<ListAllAsync()-62.5%100%
<ListAllAsync()-0%100%
ListAllAsync(...)-100%100%
ListAll(...)-100%100%
ListAvailableSizesAsync(...)-61.54%50%
<ListAvailableSizesAsync()-62.5%100%
ListAvailableSizes(...)-61.54%50%
StartCaptureAsync()-0%0%
StartCapture(...)-0%0%
StartCreateOrUpdateAsync()-78.57%50%
StartCreateOrUpdate(...)-78.57%50%
StartUpdateAsync()-57.14%50%
StartUpdate(...)-57.14%50%
StartDeleteAsync()-58.33%50%
StartDelete(...)-58.33%50%
StartConvertToManagedDisksAsync()-0%0%
StartConvertToManagedDisks(...)-0%0%
StartDeallocateAsync()-58.33%50%
StartDeallocate(...)-58.33%50%
StartPowerOffAsync()-58.33%50%
StartPowerOff(...)-58.33%50%
StartReapplyAsync()-58.33%50%
StartReapply(...)-58.33%50%
StartRestartAsync()-0%0%
StartRestart(...)-0%0%
StartStartAsync()-58.33%50%
StartStart(...)-58.33%50%
StartRedeployAsync()-58.33%50%
StartRedeploy(...)-58.33%50%
StartReimageAsync()-0%0%
StartReimage(...)-0%0%
StartPerformMaintenanceAsync()-66.67%50%
StartPerformMaintenance(...)-66.67%50%
StartRunCommandAsync()-0%0%
StartRunCommand(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachinesOperations.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 VirtualMachines service client. </summary>
 19    public partial class VirtualMachinesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 65223        internal VirtualMachinesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of VirtualMachinesOperations for mocking. </summary>
 39625        protected VirtualMachinesOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of VirtualMachinesOperations. </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 VirtualMachinesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti
 34        {
 39635            RestClient = new VirtualMachinesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Retrieves information about the model view or the instance view of a virtual machine. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="vmName"> The name of the virtual machine. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<VirtualMachine>> GetAsync(string resourceGroupName, string vmName, Cancellati
 45        {
 7646            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Get");
 7647            scope.Start();
 48            try
 49            {
 7650                return await RestClient.GetAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwait(false);
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 7657        }
 58
 59        /// <summary> Retrieves information about the model view or the instance view of a virtual machine. </summary>
 60        /// <param name="resourceGroupName"> The name of the resource group. </param>
 61        /// <param name="vmName"> The name of the virtual machine. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<VirtualMachine> Get(string resourceGroupName, string vmName, CancellationToken cancellat
 64        {
 7665            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Get");
 7666            scope.Start();
 67            try
 68            {
 7669                return RestClient.Get(resourceGroupName, vmName, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 7676        }
 77
 78        /// <summary> Retrieves information about the run-time state of a virtual machine. </summary>
 79        /// <param name="resourceGroupName"> The name of the resource group. </param>
 80        /// <param name="vmName"> The name of the virtual machine. </param>
 81        /// <param name="cancellationToken"> The cancellation token to use. </param>
 82        public virtual async Task<Response<VirtualMachineInstanceView>> InstanceViewAsync(string resourceGroupName, stri
 83        {
 884            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.InstanceView");
 885            scope.Start();
 86            try
 87            {
 888                return await RestClient.InstanceViewAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwait(f
 89            }
 090            catch (Exception e)
 91            {
 092                scope.Failed(e);
 093                throw;
 94            }
 895        }
 96
 97        /// <summary> Retrieves information about the run-time state of a virtual machine. </summary>
 98        /// <param name="resourceGroupName"> The name of the resource group. </param>
 99        /// <param name="vmName"> The name of the virtual machine. </param>
 100        /// <param name="cancellationToken"> The cancellation token to use. </param>
 101        public virtual Response<VirtualMachineInstanceView> InstanceView(string resourceGroupName, string vmName, Cancel
 102        {
 8103            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.InstanceView");
 8104            scope.Start();
 105            try
 106            {
 8107                return RestClient.InstanceView(resourceGroupName, vmName, cancellationToken);
 108            }
 0109            catch (Exception e)
 110            {
 0111                scope.Failed(e);
 0112                throw;
 113            }
 8114        }
 115
 116        /// <summary> Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual 
 117        /// <param name="resourceGroupName"> The name of the resource group. </param>
 118        /// <param name="vmName"> The name of the virtual machine. </param>
 119        /// <param name="cancellationToken"> The cancellation token to use. </param>
 120        public virtual async Task<Response> GeneralizeAsync(string resourceGroupName, string vmName, CancellationToken c
 121        {
 0122            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Generalize");
 0123            scope.Start();
 124            try
 125            {
 0126                return await RestClient.GeneralizeAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwait(fal
 127            }
 0128            catch (Exception e)
 129            {
 0130                scope.Failed(e);
 0131                throw;
 132            }
 0133        }
 134
 135        /// <summary> Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual 
 136        /// <param name="resourceGroupName"> The name of the resource group. </param>
 137        /// <param name="vmName"> The name of the virtual machine. </param>
 138        /// <param name="cancellationToken"> The cancellation token to use. </param>
 139        public virtual Response Generalize(string resourceGroupName, string vmName, CancellationToken cancellationToken 
 140        {
 0141            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Generalize");
 0142            scope.Start();
 143            try
 144            {
 0145                return RestClient.Generalize(resourceGroupName, vmName, cancellationToken);
 146            }
 0147            catch (Exception e)
 148            {
 0149                scope.Failed(e);
 0150                throw;
 151            }
 0152        }
 153
 154        /// <summary> The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 
 155        /// <param name="resourceGroupName"> The name of the resource group. </param>
 156        /// <param name="vmName"> The name of the virtual machine. </param>
 157        /// <param name="cancellationToken"> The cancellation token to use. </param>
 158        public virtual async Task<Response> SimulateEvictionAsync(string resourceGroupName, string vmName, CancellationT
 159        {
 2160            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.SimulateEviction");
 2161            scope.Start();
 162            try
 163            {
 2164                return await RestClient.SimulateEvictionAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwa
 165            }
 0166            catch (Exception e)
 167            {
 0168                scope.Failed(e);
 0169                throw;
 170            }
 2171        }
 172
 173        /// <summary> The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 
 174        /// <param name="resourceGroupName"> The name of the resource group. </param>
 175        /// <param name="vmName"> The name of the virtual machine. </param>
 176        /// <param name="cancellationToken"> The cancellation token to use. </param>
 177        public virtual Response SimulateEviction(string resourceGroupName, string vmName, CancellationToken cancellation
 178        {
 2179            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.SimulateEviction");
 2180            scope.Start();
 181            try
 182            {
 2183                return RestClient.SimulateEviction(resourceGroupName, vmName, cancellationToken);
 184            }
 0185            catch (Exception e)
 186            {
 0187                scope.Failed(e);
 0188                throw;
 189            }
 2190        }
 191
 192        /// <summary> Gets all the virtual machines under the specified subscription for the specified location. </summa
 193        /// <param name="location"> The location for which virtual machines under the subscription are queried. </param>
 194        /// <param name="cancellationToken"> The cancellation token to use. </param>
 195        public virtual AsyncPageable<VirtualMachine> ListByLocationAsync(string location, CancellationToken cancellation
 196        {
 2197            if (location == null)
 198            {
 0199                throw new ArgumentNullException(nameof(location));
 200            }
 201
 202            async Task<Page<VirtualMachine>> FirstPageFunc(int? pageSizeHint)
 203            {
 2204                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation");
 2205                scope.Start();
 206                try
 207                {
 2208                    var response = await RestClient.ListByLocationAsync(location, cancellationToken).ConfigureAwait(fals
 2209                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 210                }
 0211                catch (Exception e)
 212                {
 0213                    scope.Failed(e);
 0214                    throw;
 215                }
 2216            }
 217            async Task<Page<VirtualMachine>> NextPageFunc(string nextLink, int? pageSizeHint)
 218            {
 0219                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation");
 0220                scope.Start();
 221                try
 222                {
 0223                    var response = await RestClient.ListByLocationNextPageAsync(nextLink, location, cancellationToken).C
 0224                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 225                }
 0226                catch (Exception e)
 227                {
 0228                    scope.Failed(e);
 0229                    throw;
 230                }
 0231            }
 2232            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 233        }
 234
 235        /// <summary> Gets all the virtual machines under the specified subscription for the specified location. </summa
 236        /// <param name="location"> The location for which virtual machines under the subscription are queried. </param>
 237        /// <param name="cancellationToken"> The cancellation token to use. </param>
 238        public virtual Pageable<VirtualMachine> ListByLocation(string location, CancellationToken cancellationToken = de
 239        {
 2240            if (location == null)
 241            {
 0242                throw new ArgumentNullException(nameof(location));
 243            }
 244
 245            Page<VirtualMachine> FirstPageFunc(int? pageSizeHint)
 246            {
 2247                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation");
 2248                scope.Start();
 249                try
 250                {
 2251                    var response = RestClient.ListByLocation(location, cancellationToken);
 2252                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 253                }
 0254                catch (Exception e)
 255                {
 0256                    scope.Failed(e);
 0257                    throw;
 258                }
 2259            }
 260            Page<VirtualMachine> NextPageFunc(string nextLink, int? pageSizeHint)
 261            {
 0262                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation");
 0263                scope.Start();
 264                try
 265                {
 0266                    var response = RestClient.ListByLocationNextPage(nextLink, location, cancellationToken);
 0267                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 268                }
 0269                catch (Exception e)
 270                {
 0271                    scope.Failed(e);
 0272                    throw;
 273                }
 0274            }
 2275            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 276        }
 277
 278        /// <summary> Lists all of the virtual machines in the specified resource group. Use the nextLink property in th
 279        /// <param name="resourceGroupName"> The name of the resource group. </param>
 280        /// <param name="cancellationToken"> The cancellation token to use. </param>
 281        public virtual AsyncPageable<VirtualMachine> ListAsync(string resourceGroupName, CancellationToken cancellationT
 282        {
 8283            if (resourceGroupName == null)
 284            {
 0285                throw new ArgumentNullException(nameof(resourceGroupName));
 286            }
 287
 288            async Task<Page<VirtualMachine>> FirstPageFunc(int? pageSizeHint)
 289            {
 8290                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List");
 8291                scope.Start();
 292                try
 293                {
 8294                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 8295                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 296                }
 0297                catch (Exception e)
 298                {
 0299                    scope.Failed(e);
 0300                    throw;
 301                }
 8302            }
 303            async Task<Page<VirtualMachine>> NextPageFunc(string nextLink, int? pageSizeHint)
 304            {
 0305                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List");
 0306                scope.Start();
 307                try
 308                {
 0309                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 0310                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 311                }
 0312                catch (Exception e)
 313                {
 0314                    scope.Failed(e);
 0315                    throw;
 316                }
 0317            }
 8318            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 319        }
 320
 321        /// <summary> Lists all of the virtual machines in the specified resource group. Use the nextLink property in th
 322        /// <param name="resourceGroupName"> The name of the resource group. </param>
 323        /// <param name="cancellationToken"> The cancellation token to use. </param>
 324        public virtual Pageable<VirtualMachine> List(string resourceGroupName, CancellationToken cancellationToken = def
 325        {
 8326            if (resourceGroupName == null)
 327            {
 0328                throw new ArgumentNullException(nameof(resourceGroupName));
 329            }
 330
 331            Page<VirtualMachine> FirstPageFunc(int? pageSizeHint)
 332            {
 8333                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List");
 8334                scope.Start();
 335                try
 336                {
 8337                    var response = RestClient.List(resourceGroupName, cancellationToken);
 8338                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 339                }
 0340                catch (Exception e)
 341                {
 0342                    scope.Failed(e);
 0343                    throw;
 344                }
 8345            }
 346            Page<VirtualMachine> NextPageFunc(string nextLink, int? pageSizeHint)
 347            {
 0348                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List");
 0349                scope.Start();
 350                try
 351                {
 0352                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
 0353                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 354                }
 0355                catch (Exception e)
 356                {
 0357                    scope.Failed(e);
 0358                    throw;
 359                }
 0360            }
 8361            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 362        }
 363
 364        /// <summary> Lists all of the virtual machines in the specified subscription. Use the nextLink property in the 
 365        /// <param name="statusOnly"> statusOnly=true enables fetching run time status of all Virtual Machines in the su
 366        /// <param name="cancellationToken"> The cancellation token to use. </param>
 367        public virtual AsyncPageable<VirtualMachine> ListAllAsync(string statusOnly = null, CancellationToken cancellati
 368        {
 369            async Task<Page<VirtualMachine>> FirstPageFunc(int? pageSizeHint)
 370            {
 10371                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll");
 10372                scope.Start();
 373                try
 374                {
 10375                    var response = await RestClient.ListAllAsync(statusOnly, cancellationToken).ConfigureAwait(false);
 10376                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 377                }
 0378                catch (Exception e)
 379                {
 0380                    scope.Failed(e);
 0381                    throw;
 382                }
 10383            }
 384            async Task<Page<VirtualMachine>> NextPageFunc(string nextLink, int? pageSizeHint)
 385            {
 0386                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll");
 0387                scope.Start();
 388                try
 389                {
 0390                    var response = await RestClient.ListAllNextPageAsync(nextLink, statusOnly, cancellationToken).Config
 0391                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 392                }
 0393                catch (Exception e)
 394                {
 0395                    scope.Failed(e);
 0396                    throw;
 397                }
 0398            }
 10399            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 400        }
 401
 402        /// <summary> Lists all of the virtual machines in the specified subscription. Use the nextLink property in the 
 403        /// <param name="statusOnly"> statusOnly=true enables fetching run time status of all Virtual Machines in the su
 404        /// <param name="cancellationToken"> The cancellation token to use. </param>
 405        public virtual Pageable<VirtualMachine> ListAll(string statusOnly = null, CancellationToken cancellationToken = 
 406        {
 407            Page<VirtualMachine> FirstPageFunc(int? pageSizeHint)
 408            {
 10409                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll");
 10410                scope.Start();
 411                try
 412                {
 10413                    var response = RestClient.ListAll(statusOnly, cancellationToken);
 10414                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 415                }
 0416                catch (Exception e)
 417                {
 0418                    scope.Failed(e);
 0419                    throw;
 420                }
 10421            }
 422            Page<VirtualMachine> NextPageFunc(string nextLink, int? pageSizeHint)
 423            {
 0424                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll");
 0425                scope.Start();
 426                try
 427                {
 0428                    var response = RestClient.ListAllNextPage(nextLink, statusOnly, cancellationToken);
 0429                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 430                }
 0431                catch (Exception e)
 432                {
 0433                    scope.Failed(e);
 0434                    throw;
 435                }
 0436            }
 10437            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 438        }
 439
 440        /// <summary> Lists all available virtual machine sizes to which the specified virtual machine can be resized. <
 441        /// <param name="resourceGroupName"> The name of the resource group. </param>
 442        /// <param name="vmName"> The name of the virtual machine. </param>
 443        /// <param name="cancellationToken"> The cancellation token to use. </param>
 444        public virtual AsyncPageable<VirtualMachineSize> ListAvailableSizesAsync(string resourceGroupName, string vmName
 445        {
 8446            if (resourceGroupName == null)
 447            {
 0448                throw new ArgumentNullException(nameof(resourceGroupName));
 449            }
 8450            if (vmName == null)
 451            {
 0452                throw new ArgumentNullException(nameof(vmName));
 453            }
 454
 455            async Task<Page<VirtualMachineSize>> FirstPageFunc(int? pageSizeHint)
 456            {
 8457                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAvailableSizes");
 8458                scope.Start();
 459                try
 460                {
 8461                    var response = await RestClient.ListAvailableSizesAsync(resourceGroupName, vmName, cancellationToken
 8462                    return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
 463                }
 0464                catch (Exception e)
 465                {
 0466                    scope.Failed(e);
 0467                    throw;
 468                }
 8469            }
 8470            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
 471        }
 472
 473        /// <summary> Lists all available virtual machine sizes to which the specified virtual machine can be resized. <
 474        /// <param name="resourceGroupName"> The name of the resource group. </param>
 475        /// <param name="vmName"> The name of the virtual machine. </param>
 476        /// <param name="cancellationToken"> The cancellation token to use. </param>
 477        public virtual Pageable<VirtualMachineSize> ListAvailableSizes(string resourceGroupName, string vmName, Cancella
 478        {
 8479            if (resourceGroupName == null)
 480            {
 0481                throw new ArgumentNullException(nameof(resourceGroupName));
 482            }
 8483            if (vmName == null)
 484            {
 0485                throw new ArgumentNullException(nameof(vmName));
 486            }
 487
 488            Page<VirtualMachineSize> FirstPageFunc(int? pageSizeHint)
 489            {
 8490                using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAvailableSizes");
 8491                scope.Start();
 492                try
 493                {
 8494                    var response = RestClient.ListAvailableSizes(resourceGroupName, vmName, cancellationToken);
 8495                    return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
 496                }
 0497                catch (Exception e)
 498                {
 0499                    scope.Failed(e);
 0500                    throw;
 501                }
 8502            }
 8503            return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
 504        }
 505
 506        /// <summary> Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to
 507        /// <param name="resourceGroupName"> The name of the resource group. </param>
 508        /// <param name="vmName"> The name of the virtual machine. </param>
 509        /// <param name="parameters"> Parameters supplied to the Capture Virtual Machine operation. </param>
 510        /// <param name="cancellationToken"> The cancellation token to use. </param>
 511        public virtual async Task<VirtualMachinesCaptureOperation> StartCaptureAsync(string resourceGroupName, string vm
 512        {
 0513            if (resourceGroupName == null)
 514            {
 0515                throw new ArgumentNullException(nameof(resourceGroupName));
 516            }
 0517            if (vmName == null)
 518            {
 0519                throw new ArgumentNullException(nameof(vmName));
 520            }
 0521            if (parameters == null)
 522            {
 0523                throw new ArgumentNullException(nameof(parameters));
 524            }
 525
 0526            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCapture");
 0527            scope.Start();
 528            try
 529            {
 0530                var originalResponse = await RestClient.CaptureAsync(resourceGroupName, vmName, parameters, cancellation
 0531                return new VirtualMachinesCaptureOperation(_clientDiagnostics, _pipeline, RestClient.CreateCaptureReques
 532            }
 0533            catch (Exception e)
 534            {
 0535                scope.Failed(e);
 0536                throw;
 537            }
 0538        }
 539
 540        /// <summary> Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to
 541        /// <param name="resourceGroupName"> The name of the resource group. </param>
 542        /// <param name="vmName"> The name of the virtual machine. </param>
 543        /// <param name="parameters"> Parameters supplied to the Capture Virtual Machine operation. </param>
 544        /// <param name="cancellationToken"> The cancellation token to use. </param>
 545        public virtual VirtualMachinesCaptureOperation StartCapture(string resourceGroupName, string vmName, VirtualMach
 546        {
 0547            if (resourceGroupName == null)
 548            {
 0549                throw new ArgumentNullException(nameof(resourceGroupName));
 550            }
 0551            if (vmName == null)
 552            {
 0553                throw new ArgumentNullException(nameof(vmName));
 554            }
 0555            if (parameters == null)
 556            {
 0557                throw new ArgumentNullException(nameof(parameters));
 558            }
 559
 0560            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCapture");
 0561            scope.Start();
 562            try
 563            {
 0564                var originalResponse = RestClient.Capture(resourceGroupName, vmName, parameters, cancellationToken);
 0565                return new VirtualMachinesCaptureOperation(_clientDiagnostics, _pipeline, RestClient.CreateCaptureReques
 566            }
 0567            catch (Exception e)
 568            {
 0569                scope.Failed(e);
 0570                throw;
 571            }
 0572        }
 573
 574        /// <summary> The operation to create or update a virtual machine. Please note some properties can be set only d
 575        /// <param name="resourceGroupName"> The name of the resource group. </param>
 576        /// <param name="vmName"> The name of the virtual machine. </param>
 577        /// <param name="parameters"> Parameters supplied to the Create Virtual Machine operation. </param>
 578        /// <param name="cancellationToken"> The cancellation token to use. </param>
 579        public virtual async Task<VirtualMachinesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupN
 580        {
 62581            if (resourceGroupName == null)
 582            {
 0583                throw new ArgumentNullException(nameof(resourceGroupName));
 584            }
 62585            if (vmName == null)
 586            {
 0587                throw new ArgumentNullException(nameof(vmName));
 588            }
 62589            if (parameters == null)
 590            {
 0591                throw new ArgumentNullException(nameof(parameters));
 592            }
 593
 62594            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCreateOrUpdate");
 62595            scope.Start();
 596            try
 597            {
 62598                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vmName, parameters, cance
 60599                return new VirtualMachinesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate
 600            }
 2601            catch (Exception e)
 602            {
 2603                scope.Failed(e);
 2604                throw;
 605            }
 60606        }
 607
 608        /// <summary> The operation to create or update a virtual machine. Please note some properties can be set only d
 609        /// <param name="resourceGroupName"> The name of the resource group. </param>
 610        /// <param name="vmName"> The name of the virtual machine. </param>
 611        /// <param name="parameters"> Parameters supplied to the Create Virtual Machine operation. </param>
 612        /// <param name="cancellationToken"> The cancellation token to use. </param>
 613        public virtual VirtualMachinesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string vmNam
 614        {
 62615            if (resourceGroupName == null)
 616            {
 0617                throw new ArgumentNullException(nameof(resourceGroupName));
 618            }
 62619            if (vmName == null)
 620            {
 0621                throw new ArgumentNullException(nameof(vmName));
 622            }
 62623            if (parameters == null)
 624            {
 0625                throw new ArgumentNullException(nameof(parameters));
 626            }
 627
 62628            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCreateOrUpdate");
 62629            scope.Start();
 630            try
 631            {
 62632                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vmName, parameters, cancellationToke
 60633                return new VirtualMachinesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate
 634            }
 2635            catch (Exception e)
 636            {
 2637                scope.Failed(e);
 2638                throw;
 639            }
 60640        }
 641
 642        /// <summary> The operation to update a virtual machine. </summary>
 643        /// <param name="resourceGroupName"> The name of the resource group. </param>
 644        /// <param name="vmName"> The name of the virtual machine. </param>
 645        /// <param name="parameters"> Parameters supplied to the Update Virtual Machine operation. </param>
 646        /// <param name="cancellationToken"> The cancellation token to use. </param>
 647        public virtual async Task<VirtualMachinesUpdateOperation> StartUpdateAsync(string resourceGroupName, string vmNa
 648        {
 2649            if (resourceGroupName == null)
 650            {
 0651                throw new ArgumentNullException(nameof(resourceGroupName));
 652            }
 2653            if (vmName == null)
 654            {
 0655                throw new ArgumentNullException(nameof(vmName));
 656            }
 2657            if (parameters == null)
 658            {
 0659                throw new ArgumentNullException(nameof(parameters));
 660            }
 661
 2662            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartUpdate");
 2663            scope.Start();
 664            try
 665            {
 2666                var originalResponse = await RestClient.UpdateAsync(resourceGroupName, vmName, parameters, cancellationT
 2667                return new VirtualMachinesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(
 668            }
 0669            catch (Exception e)
 670            {
 0671                scope.Failed(e);
 0672                throw;
 673            }
 2674        }
 675
 676        /// <summary> The operation to update a virtual machine. </summary>
 677        /// <param name="resourceGroupName"> The name of the resource group. </param>
 678        /// <param name="vmName"> The name of the virtual machine. </param>
 679        /// <param name="parameters"> Parameters supplied to the Update Virtual Machine operation. </param>
 680        /// <param name="cancellationToken"> The cancellation token to use. </param>
 681        public virtual VirtualMachinesUpdateOperation StartUpdate(string resourceGroupName, string vmName, VirtualMachin
 682        {
 2683            if (resourceGroupName == null)
 684            {
 0685                throw new ArgumentNullException(nameof(resourceGroupName));
 686            }
 2687            if (vmName == null)
 688            {
 0689                throw new ArgumentNullException(nameof(vmName));
 690            }
 2691            if (parameters == null)
 692            {
 0693                throw new ArgumentNullException(nameof(parameters));
 694            }
 695
 2696            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartUpdate");
 2697            scope.Start();
 698            try
 699            {
 2700                var originalResponse = RestClient.Update(resourceGroupName, vmName, parameters, cancellationToken);
 2701                return new VirtualMachinesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(
 702            }
 0703            catch (Exception e)
 704            {
 0705                scope.Failed(e);
 0706                throw;
 707            }
 2708        }
 709
 710        /// <summary> The operation to delete a virtual machine. </summary>
 711        /// <param name="resourceGroupName"> The name of the resource group. </param>
 712        /// <param name="vmName"> The name of the virtual machine. </param>
 713        /// <param name="cancellationToken"> The cancellation token to use. </param>
 714        public virtual async Task<VirtualMachinesDeleteOperation> StartDeleteAsync(string resourceGroupName, string vmNa
 715        {
 26716            if (resourceGroupName == null)
 717            {
 0718                throw new ArgumentNullException(nameof(resourceGroupName));
 719            }
 26720            if (vmName == null)
 721            {
 0722                throw new ArgumentNullException(nameof(vmName));
 723            }
 724
 26725            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDelete");
 26726            scope.Start();
 727            try
 728            {
 26729                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, vmName, cancellationToken).Config
 26730                return new VirtualMachinesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(
 731            }
 0732            catch (Exception e)
 733            {
 0734                scope.Failed(e);
 0735                throw;
 736            }
 26737        }
 738
 739        /// <summary> The operation to delete a virtual machine. </summary>
 740        /// <param name="resourceGroupName"> The name of the resource group. </param>
 741        /// <param name="vmName"> The name of the virtual machine. </param>
 742        /// <param name="cancellationToken"> The cancellation token to use. </param>
 743        public virtual VirtualMachinesDeleteOperation StartDelete(string resourceGroupName, string vmName, CancellationT
 744        {
 26745            if (resourceGroupName == null)
 746            {
 0747                throw new ArgumentNullException(nameof(resourceGroupName));
 748            }
 26749            if (vmName == null)
 750            {
 0751                throw new ArgumentNullException(nameof(vmName));
 752            }
 753
 26754            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDelete");
 26755            scope.Start();
 756            try
 757            {
 26758                var originalResponse = RestClient.Delete(resourceGroupName, vmName, cancellationToken);
 26759                return new VirtualMachinesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(
 760            }
 0761            catch (Exception e)
 762            {
 0763                scope.Failed(e);
 0764                throw;
 765            }
 26766        }
 767
 768        /// <summary> Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deal
 769        /// <param name="resourceGroupName"> The name of the resource group. </param>
 770        /// <param name="vmName"> The name of the virtual machine. </param>
 771        /// <param name="cancellationToken"> The cancellation token to use. </param>
 772        public virtual async Task<VirtualMachinesConvertToManagedDisksOperation> StartConvertToManagedDisksAsync(string 
 773        {
 0774            if (resourceGroupName == null)
 775            {
 0776                throw new ArgumentNullException(nameof(resourceGroupName));
 777            }
 0778            if (vmName == null)
 779            {
 0780                throw new ArgumentNullException(nameof(vmName));
 781            }
 782
 0783            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartConvertToManagedDisks");
 0784            scope.Start();
 785            try
 786            {
 0787                var originalResponse = await RestClient.ConvertToManagedDisksAsync(resourceGroupName, vmName, cancellati
 0788                return new VirtualMachinesConvertToManagedDisksOperation(_clientDiagnostics, _pipeline, RestClient.Creat
 789            }
 0790            catch (Exception e)
 791            {
 0792                scope.Failed(e);
 0793                throw;
 794            }
 0795        }
 796
 797        /// <summary> Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deal
 798        /// <param name="resourceGroupName"> The name of the resource group. </param>
 799        /// <param name="vmName"> The name of the virtual machine. </param>
 800        /// <param name="cancellationToken"> The cancellation token to use. </param>
 801        public virtual VirtualMachinesConvertToManagedDisksOperation StartConvertToManagedDisks(string resourceGroupName
 802        {
 0803            if (resourceGroupName == null)
 804            {
 0805                throw new ArgumentNullException(nameof(resourceGroupName));
 806            }
 0807            if (vmName == null)
 808            {
 0809                throw new ArgumentNullException(nameof(vmName));
 810            }
 811
 0812            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartConvertToManagedDisks");
 0813            scope.Start();
 814            try
 815            {
 0816                var originalResponse = RestClient.ConvertToManagedDisks(resourceGroupName, vmName, cancellationToken);
 0817                return new VirtualMachinesConvertToManagedDisksOperation(_clientDiagnostics, _pipeline, RestClient.Creat
 818            }
 0819            catch (Exception e)
 820            {
 0821                scope.Failed(e);
 0822                throw;
 823            }
 0824        }
 825
 826        /// <summary> Shuts down the virtual machine and releases the compute resources. You are not billed for the comp
 827        /// <param name="resourceGroupName"> The name of the resource group. </param>
 828        /// <param name="vmName"> The name of the virtual machine. </param>
 829        /// <param name="cancellationToken"> The cancellation token to use. </param>
 830        public virtual async Task<VirtualMachinesDeallocateOperation> StartDeallocateAsync(string resourceGroupName, str
 831        {
 2832            if (resourceGroupName == null)
 833            {
 0834                throw new ArgumentNullException(nameof(resourceGroupName));
 835            }
 2836            if (vmName == null)
 837            {
 0838                throw new ArgumentNullException(nameof(vmName));
 839            }
 840
 2841            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDeallocate");
 2842            scope.Start();
 843            try
 844            {
 2845                var originalResponse = await RestClient.DeallocateAsync(resourceGroupName, vmName, cancellationToken).Co
 2846                return new VirtualMachinesDeallocateOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeallocate
 847            }
 0848            catch (Exception e)
 849            {
 0850                scope.Failed(e);
 0851                throw;
 852            }
 2853        }
 854
 855        /// <summary> Shuts down the virtual machine and releases the compute resources. You are not billed for the comp
 856        /// <param name="resourceGroupName"> The name of the resource group. </param>
 857        /// <param name="vmName"> The name of the virtual machine. </param>
 858        /// <param name="cancellationToken"> The cancellation token to use. </param>
 859        public virtual VirtualMachinesDeallocateOperation StartDeallocate(string resourceGroupName, string vmName, Cance
 860        {
 2861            if (resourceGroupName == null)
 862            {
 0863                throw new ArgumentNullException(nameof(resourceGroupName));
 864            }
 2865            if (vmName == null)
 866            {
 0867                throw new ArgumentNullException(nameof(vmName));
 868            }
 869
 2870            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDeallocate");
 2871            scope.Start();
 872            try
 873            {
 2874                var originalResponse = RestClient.Deallocate(resourceGroupName, vmName, cancellationToken);
 2875                return new VirtualMachinesDeallocateOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeallocate
 876            }
 0877            catch (Exception e)
 878            {
 0879                scope.Failed(e);
 0880                throw;
 881            }
 2882        }
 883
 884        /// <summary> The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the
 885        /// <param name="resourceGroupName"> The name of the resource group. </param>
 886        /// <param name="vmName"> The name of the virtual machine. </param>
 887        /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi
 888        /// <param name="cancellationToken"> The cancellation token to use. </param>
 889        public virtual async Task<VirtualMachinesPowerOffOperation> StartPowerOffAsync(string resourceGroupName, string 
 890        {
 2891            if (resourceGroupName == null)
 892            {
 0893                throw new ArgumentNullException(nameof(resourceGroupName));
 894            }
 2895            if (vmName == null)
 896            {
 0897                throw new ArgumentNullException(nameof(vmName));
 898            }
 899
 2900            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPowerOff");
 2901            scope.Start();
 902            try
 903            {
 2904                var originalResponse = await RestClient.PowerOffAsync(resourceGroupName, vmName, skipShutdown, cancellat
 2905                return new VirtualMachinesPowerOffOperation(_clientDiagnostics, _pipeline, RestClient.CreatePowerOffRequ
 906            }
 0907            catch (Exception e)
 908            {
 0909                scope.Failed(e);
 0910                throw;
 911            }
 2912        }
 913
 914        /// <summary> The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the
 915        /// <param name="resourceGroupName"> The name of the resource group. </param>
 916        /// <param name="vmName"> The name of the virtual machine. </param>
 917        /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi
 918        /// <param name="cancellationToken"> The cancellation token to use. </param>
 919        public virtual VirtualMachinesPowerOffOperation StartPowerOff(string resourceGroupName, string vmName, bool? ski
 920        {
 2921            if (resourceGroupName == null)
 922            {
 0923                throw new ArgumentNullException(nameof(resourceGroupName));
 924            }
 2925            if (vmName == null)
 926            {
 0927                throw new ArgumentNullException(nameof(vmName));
 928            }
 929
 2930            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPowerOff");
 2931            scope.Start();
 932            try
 933            {
 2934                var originalResponse = RestClient.PowerOff(resourceGroupName, vmName, skipShutdown, cancellationToken);
 2935                return new VirtualMachinesPowerOffOperation(_clientDiagnostics, _pipeline, RestClient.CreatePowerOffRequ
 936            }
 0937            catch (Exception e)
 938            {
 0939                scope.Failed(e);
 0940                throw;
 941            }
 2942        }
 943
 944        /// <summary> The operation to reapply a virtual machine&apos;s state. </summary>
 945        /// <param name="resourceGroupName"> The name of the resource group. </param>
 946        /// <param name="vmName"> The name of the virtual machine. </param>
 947        /// <param name="cancellationToken"> The cancellation token to use. </param>
 948        public virtual async Task<VirtualMachinesReapplyOperation> StartReapplyAsync(string resourceGroupName, string vm
 949        {
 4950            if (resourceGroupName == null)
 951            {
 0952                throw new ArgumentNullException(nameof(resourceGroupName));
 953            }
 4954            if (vmName == null)
 955            {
 0956                throw new ArgumentNullException(nameof(vmName));
 957            }
 958
 4959            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReapply");
 4960            scope.Start();
 961            try
 962            {
 4963                var originalResponse = await RestClient.ReapplyAsync(resourceGroupName, vmName, cancellationToken).Confi
 4964                return new VirtualMachinesReapplyOperation(_clientDiagnostics, _pipeline, RestClient.CreateReapplyReques
 965            }
 0966            catch (Exception e)
 967            {
 0968                scope.Failed(e);
 0969                throw;
 970            }
 4971        }
 972
 973        /// <summary> The operation to reapply a virtual machine&apos;s state. </summary>
 974        /// <param name="resourceGroupName"> The name of the resource group. </param>
 975        /// <param name="vmName"> The name of the virtual machine. </param>
 976        /// <param name="cancellationToken"> The cancellation token to use. </param>
 977        public virtual VirtualMachinesReapplyOperation StartReapply(string resourceGroupName, string vmName, Cancellatio
 978        {
 4979            if (resourceGroupName == null)
 980            {
 0981                throw new ArgumentNullException(nameof(resourceGroupName));
 982            }
 4983            if (vmName == null)
 984            {
 0985                throw new ArgumentNullException(nameof(vmName));
 986            }
 987
 4988            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReapply");
 4989            scope.Start();
 990            try
 991            {
 4992                var originalResponse = RestClient.Reapply(resourceGroupName, vmName, cancellationToken);
 4993                return new VirtualMachinesReapplyOperation(_clientDiagnostics, _pipeline, RestClient.CreateReapplyReques
 994            }
 0995            catch (Exception e)
 996            {
 0997                scope.Failed(e);
 0998                throw;
 999            }
 41000        }
 1001
 1002        /// <summary> The operation to restart a virtual machine. </summary>
 1003        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1004        /// <param name="vmName"> The name of the virtual machine. </param>
 1005        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1006        public virtual async Task<VirtualMachinesRestartOperation> StartRestartAsync(string resourceGroupName, string vm
 1007        {
 01008            if (resourceGroupName == null)
 1009            {
 01010                throw new ArgumentNullException(nameof(resourceGroupName));
 1011            }
 01012            if (vmName == null)
 1013            {
 01014                throw new ArgumentNullException(nameof(vmName));
 1015            }
 1016
 01017            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRestart");
 01018            scope.Start();
 1019            try
 1020            {
 01021                var originalResponse = await RestClient.RestartAsync(resourceGroupName, vmName, cancellationToken).Confi
 01022                return new VirtualMachinesRestartOperation(_clientDiagnostics, _pipeline, RestClient.CreateRestartReques
 1023            }
 01024            catch (Exception e)
 1025            {
 01026                scope.Failed(e);
 01027                throw;
 1028            }
 01029        }
 1030
 1031        /// <summary> The operation to restart a virtual machine. </summary>
 1032        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1033        /// <param name="vmName"> The name of the virtual machine. </param>
 1034        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1035        public virtual VirtualMachinesRestartOperation StartRestart(string resourceGroupName, string vmName, Cancellatio
 1036        {
 01037            if (resourceGroupName == null)
 1038            {
 01039                throw new ArgumentNullException(nameof(resourceGroupName));
 1040            }
 01041            if (vmName == null)
 1042            {
 01043                throw new ArgumentNullException(nameof(vmName));
 1044            }
 1045
 01046            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRestart");
 01047            scope.Start();
 1048            try
 1049            {
 01050                var originalResponse = RestClient.Restart(resourceGroupName, vmName, cancellationToken);
 01051                return new VirtualMachinesRestartOperation(_clientDiagnostics, _pipeline, RestClient.CreateRestartReques
 1052            }
 01053            catch (Exception e)
 1054            {
 01055                scope.Failed(e);
 01056                throw;
 1057            }
 01058        }
 1059
 1060        /// <summary> The operation to start a virtual machine. </summary>
 1061        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1062        /// <param name="vmName"> The name of the virtual machine. </param>
 1063        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1064        public virtual async Task<VirtualMachinesStartOperation> StartStartAsync(string resourceGroupName, string vmName
 1065        {
 41066            if (resourceGroupName == null)
 1067            {
 01068                throw new ArgumentNullException(nameof(resourceGroupName));
 1069            }
 41070            if (vmName == null)
 1071            {
 01072                throw new ArgumentNullException(nameof(vmName));
 1073            }
 1074
 41075            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartStart");
 41076            scope.Start();
 1077            try
 1078            {
 41079                var originalResponse = await RestClient.StartAsync(resourceGroupName, vmName, cancellationToken).Configu
 41080                return new VirtualMachinesStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRequest(re
 1081            }
 01082            catch (Exception e)
 1083            {
 01084                scope.Failed(e);
 01085                throw;
 1086            }
 41087        }
 1088
 1089        /// <summary> The operation to start a virtual machine. </summary>
 1090        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1091        /// <param name="vmName"> The name of the virtual machine. </param>
 1092        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1093        public virtual VirtualMachinesStartOperation StartStart(string resourceGroupName, string vmName, CancellationTok
 1094        {
 41095            if (resourceGroupName == null)
 1096            {
 01097                throw new ArgumentNullException(nameof(resourceGroupName));
 1098            }
 41099            if (vmName == null)
 1100            {
 01101                throw new ArgumentNullException(nameof(vmName));
 1102            }
 1103
 41104            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartStart");
 41105            scope.Start();
 1106            try
 1107            {
 41108                var originalResponse = RestClient.Start(resourceGroupName, vmName, cancellationToken);
 41109                return new VirtualMachinesStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRequest(re
 1110            }
 01111            catch (Exception e)
 1112            {
 01113                scope.Failed(e);
 01114                throw;
 1115            }
 41116        }
 1117
 1118        /// <summary> Shuts down the virtual machine, moves it to a new node, and powers it back on. </summary>
 1119        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1120        /// <param name="vmName"> The name of the virtual machine. </param>
 1121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1122        public virtual async Task<VirtualMachinesRedeployOperation> StartRedeployAsync(string resourceGroupName, string 
 1123        {
 41124            if (resourceGroupName == null)
 1125            {
 01126                throw new ArgumentNullException(nameof(resourceGroupName));
 1127            }
 41128            if (vmName == null)
 1129            {
 01130                throw new ArgumentNullException(nameof(vmName));
 1131            }
 1132
 41133            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRedeploy");
 41134            scope.Start();
 1135            try
 1136            {
 41137                var originalResponse = await RestClient.RedeployAsync(resourceGroupName, vmName, cancellationToken).Conf
 41138                return new VirtualMachinesRedeployOperation(_clientDiagnostics, _pipeline, RestClient.CreateRedeployRequ
 1139            }
 01140            catch (Exception e)
 1141            {
 01142                scope.Failed(e);
 01143                throw;
 1144            }
 41145        }
 1146
 1147        /// <summary> Shuts down the virtual machine, moves it to a new node, and powers it back on. </summary>
 1148        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1149        /// <param name="vmName"> The name of the virtual machine. </param>
 1150        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1151        public virtual VirtualMachinesRedeployOperation StartRedeploy(string resourceGroupName, string vmName, Cancellat
 1152        {
 41153            if (resourceGroupName == null)
 1154            {
 01155                throw new ArgumentNullException(nameof(resourceGroupName));
 1156            }
 41157            if (vmName == null)
 1158            {
 01159                throw new ArgumentNullException(nameof(vmName));
 1160            }
 1161
 41162            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRedeploy");
 41163            scope.Start();
 1164            try
 1165            {
 41166                var originalResponse = RestClient.Redeploy(resourceGroupName, vmName, cancellationToken);
 41167                return new VirtualMachinesRedeployOperation(_clientDiagnostics, _pipeline, RestClient.CreateRedeployRequ
 1168            }
 01169            catch (Exception e)
 1170            {
 01171                scope.Failed(e);
 01172                throw;
 1173            }
 41174        }
 1175
 1176        /// <summary> Reimages the virtual machine which has an ephemeral OS disk back to its initial state. </summary>
 1177        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1178        /// <param name="vmName"> The name of the virtual machine. </param>
 1179        /// <param name="parameters"> Parameters supplied to the Reimage Virtual Machine operation. </param>
 1180        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1181        public virtual async Task<VirtualMachinesReimageOperation> StartReimageAsync(string resourceGroupName, string vm
 1182        {
 01183            if (resourceGroupName == null)
 1184            {
 01185                throw new ArgumentNullException(nameof(resourceGroupName));
 1186            }
 01187            if (vmName == null)
 1188            {
 01189                throw new ArgumentNullException(nameof(vmName));
 1190            }
 1191
 01192            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReimage");
 01193            scope.Start();
 1194            try
 1195            {
 01196                var originalResponse = await RestClient.ReimageAsync(resourceGroupName, vmName, parameters, cancellation
 01197                return new VirtualMachinesReimageOperation(_clientDiagnostics, _pipeline, RestClient.CreateReimageReques
 1198            }
 01199            catch (Exception e)
 1200            {
 01201                scope.Failed(e);
 01202                throw;
 1203            }
 01204        }
 1205
 1206        /// <summary> Reimages the virtual machine which has an ephemeral OS disk back to its initial state. </summary>
 1207        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1208        /// <param name="vmName"> The name of the virtual machine. </param>
 1209        /// <param name="parameters"> Parameters supplied to the Reimage Virtual Machine operation. </param>
 1210        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1211        public virtual VirtualMachinesReimageOperation StartReimage(string resourceGroupName, string vmName, VirtualMach
 1212        {
 01213            if (resourceGroupName == null)
 1214            {
 01215                throw new ArgumentNullException(nameof(resourceGroupName));
 1216            }
 01217            if (vmName == null)
 1218            {
 01219                throw new ArgumentNullException(nameof(vmName));
 1220            }
 1221
 01222            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReimage");
 01223            scope.Start();
 1224            try
 1225            {
 01226                var originalResponse = RestClient.Reimage(resourceGroupName, vmName, parameters, cancellationToken);
 01227                return new VirtualMachinesReimageOperation(_clientDiagnostics, _pipeline, RestClient.CreateReimageReques
 1228            }
 01229            catch (Exception e)
 1230            {
 01231                scope.Failed(e);
 01232                throw;
 1233            }
 01234        }
 1235
 1236        /// <summary> The operation to perform maintenance on a virtual machine. </summary>
 1237        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1238        /// <param name="vmName"> The name of the virtual machine. </param>
 1239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1240        public virtual async Task<VirtualMachinesPerformMaintenanceOperation> StartPerformMaintenanceAsync(string resour
 1241        {
 21242            if (resourceGroupName == null)
 1243            {
 01244                throw new ArgumentNullException(nameof(resourceGroupName));
 1245            }
 21246            if (vmName == null)
 1247            {
 01248                throw new ArgumentNullException(nameof(vmName));
 1249            }
 1250
 21251            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPerformMaintenance");
 21252            scope.Start();
 1253            try
 1254            {
 21255                var originalResponse = await RestClient.PerformMaintenanceAsync(resourceGroupName, vmName, cancellationT
 01256                return new VirtualMachinesPerformMaintenanceOperation(_clientDiagnostics, _pipeline, RestClient.CreatePe
 1257            }
 21258            catch (Exception e)
 1259            {
 21260                scope.Failed(e);
 21261                throw;
 1262            }
 01263        }
 1264
 1265        /// <summary> The operation to perform maintenance on a virtual machine. </summary>
 1266        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1267        /// <param name="vmName"> The name of the virtual machine. </param>
 1268        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1269        public virtual VirtualMachinesPerformMaintenanceOperation StartPerformMaintenance(string resourceGroupName, stri
 1270        {
 21271            if (resourceGroupName == null)
 1272            {
 01273                throw new ArgumentNullException(nameof(resourceGroupName));
 1274            }
 21275            if (vmName == null)
 1276            {
 01277                throw new ArgumentNullException(nameof(vmName));
 1278            }
 1279
 21280            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPerformMaintenance");
 21281            scope.Start();
 1282            try
 1283            {
 21284                var originalResponse = RestClient.PerformMaintenance(resourceGroupName, vmName, cancellationToken);
 01285                return new VirtualMachinesPerformMaintenanceOperation(_clientDiagnostics, _pipeline, RestClient.CreatePe
 1286            }
 21287            catch (Exception e)
 1288            {
 21289                scope.Failed(e);
 21290                throw;
 1291            }
 01292        }
 1293
 1294        /// <summary> Run command on the VM. </summary>
 1295        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1296        /// <param name="vmName"> The name of the virtual machine. </param>
 1297        /// <param name="parameters"> Parameters supplied to the Run command operation. </param>
 1298        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1299        public virtual async Task<VirtualMachinesRunCommandOperation> StartRunCommandAsync(string resourceGroupName, str
 1300        {
 01301            if (resourceGroupName == null)
 1302            {
 01303                throw new ArgumentNullException(nameof(resourceGroupName));
 1304            }
 01305            if (vmName == null)
 1306            {
 01307                throw new ArgumentNullException(nameof(vmName));
 1308            }
 01309            if (parameters == null)
 1310            {
 01311                throw new ArgumentNullException(nameof(parameters));
 1312            }
 1313
 01314            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRunCommand");
 01315            scope.Start();
 1316            try
 1317            {
 01318                var originalResponse = await RestClient.RunCommandAsync(resourceGroupName, vmName, parameters, cancellat
 01319                return new VirtualMachinesRunCommandOperation(_clientDiagnostics, _pipeline, RestClient.CreateRunCommand
 1320            }
 01321            catch (Exception e)
 1322            {
 01323                scope.Failed(e);
 01324                throw;
 1325            }
 01326        }
 1327
 1328        /// <summary> Run command on the VM. </summary>
 1329        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1330        /// <param name="vmName"> The name of the virtual machine. </param>
 1331        /// <param name="parameters"> Parameters supplied to the Run command operation. </param>
 1332        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1333        public virtual VirtualMachinesRunCommandOperation StartRunCommand(string resourceGroupName, string vmName, RunCo
 1334        {
 01335            if (resourceGroupName == null)
 1336            {
 01337                throw new ArgumentNullException(nameof(resourceGroupName));
 1338            }
 01339            if (vmName == null)
 1340            {
 01341                throw new ArgumentNullException(nameof(vmName));
 1342            }
 01343            if (parameters == null)
 1344            {
 01345                throw new ArgumentNullException(nameof(parameters));
 1346            }
 1347
 01348            using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRunCommand");
 01349            scope.Start();
 1350            try
 1351            {
 01352                var originalResponse = RestClient.RunCommand(resourceGroupName, vmName, parameters, cancellationToken);
 01353                return new VirtualMachinesRunCommandOperation(_clientDiagnostics, _pipeline, RestClient.CreateRunCommand
 1354            }
 01355            catch (Exception e)
 1356            {
 01357                scope.Failed(e);
 01358                throw;
 1359            }
 01360        }
 1361    }
 1362}