< Summary

Class:Azure.ResourceManager.Compute.VirtualMachineScaleSetRollingUpgradesOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetRollingUpgradesOperations.cs
Covered lines:7
Uncovered lines:87
Coverable lines:94
Total lines:251
Line coverage:7.4% (7 of 94)
Covered branches:0
Total branches:24
Branch coverage:0% (0 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetLatestAsync()-0%100%
GetLatest(...)-0%100%
StartCancelAsync()-0%0%
StartCancel(...)-0%0%
StartStartOSUpgradeAsync()-0%0%
StartStartOSUpgrade(...)-0%0%
StartStartExtensionUpgradeAsync()-0%0%
StartStartExtensionUpgrade(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetRollingUpgradesOperations.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.Pipeline;
 13using Azure.ResourceManager.Compute.Models;
 14
 15namespace Azure.ResourceManager.Compute
 16{
 17    /// <summary> The VirtualMachineScaleSetRollingUpgrades service client. </summary>
 18    public partial class VirtualMachineScaleSetRollingUpgradesOperations
 19    {
 20        private readonly ClientDiagnostics _clientDiagnostics;
 21        private readonly HttpPipeline _pipeline;
 022        internal VirtualMachineScaleSetRollingUpgradesRestOperations RestClient { get; }
 23        /// <summary> Initializes a new instance of VirtualMachineScaleSetRollingUpgradesOperations for mocking. </summa
 39624        protected VirtualMachineScaleSetRollingUpgradesOperations()
 25        {
 39626        }
 27        /// <summary> Initializes a new instance of VirtualMachineScaleSetRollingUpgradesOperations. </summary>
 28        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 29        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 30        /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 31        /// <param name="endpoint"> server parameter. </param>
 39632        internal VirtualMachineScaleSetRollingUpgradesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipel
 33        {
 39634            RestClient = new VirtualMachineScaleSetRollingUpgradesRestOperations(clientDiagnostics, pipeline, subscripti
 39635            _clientDiagnostics = clientDiagnostics;
 39636            _pipeline = pipeline;
 39637        }
 38
 39        /// <summary> Gets the status of the latest virtual machine scale set rolling upgrade. </summary>
 40        /// <param name="resourceGroupName"> The name of the resource group. </param>
 41        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 42        /// <param name="cancellationToken"> The cancellation token to use. </param>
 43        public virtual async Task<Response<RollingUpgradeStatusInfo>> GetLatestAsync(string resourceGroupName, string vm
 44        {
 045            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.GetLatest"
 046            scope.Start();
 47            try
 48            {
 049                return await RestClient.GetLatestAsync(resourceGroupName, vmScaleSetName, cancellationToken).ConfigureAw
 50            }
 051            catch (Exception e)
 52            {
 053                scope.Failed(e);
 054                throw;
 55            }
 056        }
 57
 58        /// <summary> Gets the status of the latest virtual machine scale set rolling upgrade. </summary>
 59        /// <param name="resourceGroupName"> The name of the resource group. </param>
 60        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 61        /// <param name="cancellationToken"> The cancellation token to use. </param>
 62        public virtual Response<RollingUpgradeStatusInfo> GetLatest(string resourceGroupName, string vmScaleSetName, Can
 63        {
 064            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.GetLatest"
 065            scope.Start();
 66            try
 67            {
 068                return RestClient.GetLatest(resourceGroupName, vmScaleSetName, cancellationToken);
 69            }
 070            catch (Exception e)
 71            {
 072                scope.Failed(e);
 073                throw;
 74            }
 075        }
 76
 77        /// <summary> Cancels the current virtual machine scale set rolling upgrade. </summary>
 78        /// <param name="resourceGroupName"> The name of the resource group. </param>
 79        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 80        /// <param name="cancellationToken"> The cancellation token to use. </param>
 81        public virtual async Task<VirtualMachineScaleSetRollingUpgradesCancelOperation> StartCancelAsync(string resource
 82        {
 083            if (resourceGroupName == null)
 84            {
 085                throw new ArgumentNullException(nameof(resourceGroupName));
 86            }
 087            if (vmScaleSetName == null)
 88            {
 089                throw new ArgumentNullException(nameof(vmScaleSetName));
 90            }
 91
 092            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.StartCance
 093            scope.Start();
 94            try
 95            {
 096                var originalResponse = await RestClient.CancelAsync(resourceGroupName, vmScaleSetName, cancellationToken
 097                return new VirtualMachineScaleSetRollingUpgradesCancelOperation(_clientDiagnostics, _pipeline, RestClien
 98            }
 099            catch (Exception e)
 100            {
 0101                scope.Failed(e);
 0102                throw;
 103            }
 0104        }
 105
 106        /// <summary> Cancels the current virtual machine scale set rolling upgrade. </summary>
 107        /// <param name="resourceGroupName"> The name of the resource group. </param>
 108        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 109        /// <param name="cancellationToken"> The cancellation token to use. </param>
 110        public virtual VirtualMachineScaleSetRollingUpgradesCancelOperation StartCancel(string resourceGroupName, string
 111        {
 0112            if (resourceGroupName == null)
 113            {
 0114                throw new ArgumentNullException(nameof(resourceGroupName));
 115            }
 0116            if (vmScaleSetName == null)
 117            {
 0118                throw new ArgumentNullException(nameof(vmScaleSetName));
 119            }
 120
 0121            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.StartCance
 0122            scope.Start();
 123            try
 124            {
 0125                var originalResponse = RestClient.Cancel(resourceGroupName, vmScaleSetName, cancellationToken);
 0126                return new VirtualMachineScaleSetRollingUpgradesCancelOperation(_clientDiagnostics, _pipeline, RestClien
 127            }
 0128            catch (Exception e)
 129            {
 0130                scope.Failed(e);
 0131                throw;
 132            }
 0133        }
 134
 135        /// <summary> Starts a rolling upgrade to move all virtual machine scale set instances to the latest available P
 136        /// <param name="resourceGroupName"> The name of the resource group. </param>
 137        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 138        /// <param name="cancellationToken"> The cancellation token to use. </param>
 139        public virtual async Task<VirtualMachineScaleSetRollingUpgradesStartOSUpgradeOperation> StartStartOSUpgradeAsync
 140        {
 0141            if (resourceGroupName == null)
 142            {
 0143                throw new ArgumentNullException(nameof(resourceGroupName));
 144            }
 0145            if (vmScaleSetName == null)
 146            {
 0147                throw new ArgumentNullException(nameof(vmScaleSetName));
 148            }
 149
 0150            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.StartStart
 0151            scope.Start();
 152            try
 153            {
 0154                var originalResponse = await RestClient.StartOSUpgradeAsync(resourceGroupName, vmScaleSetName, cancellat
 0155                return new VirtualMachineScaleSetRollingUpgradesStartOSUpgradeOperation(_clientDiagnostics, _pipeline, R
 156            }
 0157            catch (Exception e)
 158            {
 0159                scope.Failed(e);
 0160                throw;
 161            }
 0162        }
 163
 164        /// <summary> Starts a rolling upgrade to move all virtual machine scale set instances to the latest available P
 165        /// <param name="resourceGroupName"> The name of the resource group. </param>
 166        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 168        public virtual VirtualMachineScaleSetRollingUpgradesStartOSUpgradeOperation StartStartOSUpgrade(string resourceG
 169        {
 0170            if (resourceGroupName == null)
 171            {
 0172                throw new ArgumentNullException(nameof(resourceGroupName));
 173            }
 0174            if (vmScaleSetName == null)
 175            {
 0176                throw new ArgumentNullException(nameof(vmScaleSetName));
 177            }
 178
 0179            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.StartStart
 0180            scope.Start();
 181            try
 182            {
 0183                var originalResponse = RestClient.StartOSUpgrade(resourceGroupName, vmScaleSetName, cancellationToken);
 0184                return new VirtualMachineScaleSetRollingUpgradesStartOSUpgradeOperation(_clientDiagnostics, _pipeline, R
 185            }
 0186            catch (Exception e)
 187            {
 0188                scope.Failed(e);
 0189                throw;
 190            }
 0191        }
 192
 193        /// <summary> Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the
 194        /// <param name="resourceGroupName"> The name of the resource group. </param>
 195        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 196        /// <param name="cancellationToken"> The cancellation token to use. </param>
 197        public virtual async Task<VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeOperation> StartStartExtensi
 198        {
 0199            if (resourceGroupName == null)
 200            {
 0201                throw new ArgumentNullException(nameof(resourceGroupName));
 202            }
 0203            if (vmScaleSetName == null)
 204            {
 0205                throw new ArgumentNullException(nameof(vmScaleSetName));
 206            }
 207
 0208            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.StartStart
 0209            scope.Start();
 210            try
 211            {
 0212                var originalResponse = await RestClient.StartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, ca
 0213                return new VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeOperation(_clientDiagnostics, _pipe
 214            }
 0215            catch (Exception e)
 216            {
 0217                scope.Failed(e);
 0218                throw;
 219            }
 0220        }
 221
 222        /// <summary> Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the
 223        /// <param name="resourceGroupName"> The name of the resource group. </param>
 224        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 225        /// <param name="cancellationToken"> The cancellation token to use. </param>
 226        public virtual VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeOperation StartStartExtensionUpgrade(st
 227        {
 0228            if (resourceGroupName == null)
 229            {
 0230                throw new ArgumentNullException(nameof(resourceGroupName));
 231            }
 0232            if (vmScaleSetName == null)
 233            {
 0234                throw new ArgumentNullException(nameof(vmScaleSetName));
 235            }
 236
 0237            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgradesOperations.StartStart
 0238            scope.Start();
 239            try
 240            {
 0241                var originalResponse = RestClient.StartExtensionUpgrade(resourceGroupName, vmScaleSetName, cancellationT
 0242                return new VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeOperation(_clientDiagnostics, _pipe
 243            }
 0244            catch (Exception e)
 245            {
 0246                scope.Failed(e);
 0247                throw;
 248            }
 0249        }
 250    }
 251}