< Summary

Class:Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionsOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetExtensionsOperations.cs
Covered lines:50
Uncovered lines:106
Coverable lines:156
Total lines:402
Line coverage:32% (50 of 156)
Covered branches:12
Total branches:52
Branch coverage:23% (12 of 52)

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%
ListAsync(...)-38.1%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
List(...)-38.1%50%
StartCreateOrUpdateAsync()-56.25%50%
StartCreateOrUpdate(...)-56.25%50%
StartUpdateAsync()-0%0%
StartUpdate(...)-0%0%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetExtensionsOperations.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 VirtualMachineScaleSetExtensions service client. </summary>
 19    public partial class VirtualMachineScaleSetExtensionsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 3223        internal VirtualMachineScaleSetExtensionsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of VirtualMachineScaleSetExtensionsOperations for mocking. </summary>
 39625        protected VirtualMachineScaleSetExtensionsOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of VirtualMachineScaleSetExtensionsOperations. </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 VirtualMachineScaleSetExtensionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, 
 34        {
 39635            RestClient = new VirtualMachineScaleSetExtensionsRestOperations(clientDiagnostics, pipeline, subscriptionId,
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> The operation to get the extension. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param>
 43        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 44        /// <param name="expand"> The expand expression to apply on the operation. </param>
 45        /// <param name="cancellationToken"> The cancellation token to use. </param>
 46        public virtual async Task<Response<VirtualMachineScaleSetExtension>> GetAsync(string resourceGroupName, string v
 47        {
 648            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.Get");
 649            scope.Start();
 50            try
 51            {
 652                return await RestClient.GetAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, cancellat
 53            }
 054            catch (Exception e)
 55            {
 056                scope.Failed(e);
 057                throw;
 58            }
 659        }
 60
 61        /// <summary> The operation to get the extension. </summary>
 62        /// <param name="resourceGroupName"> The name of the resource group. </param>
 63        /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param>
 64        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 65        /// <param name="expand"> The expand expression to apply on the operation. </param>
 66        /// <param name="cancellationToken"> The cancellation token to use. </param>
 67        public virtual Response<VirtualMachineScaleSetExtension> Get(string resourceGroupName, string vmScaleSetName, st
 68        {
 669            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.Get");
 670            scope.Start();
 71            try
 72            {
 673                return RestClient.Get(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, cancellationToken);
 74            }
 075            catch (Exception e)
 76            {
 077                scope.Failed(e);
 078                throw;
 79            }
 680        }
 81
 82        /// <summary> Gets a list of all extensions in a VM scale set. </summary>
 83        /// <param name="resourceGroupName"> The name of the resource group. </param>
 84        /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param>
 85        /// <param name="cancellationToken"> The cancellation token to use. </param>
 86        public virtual AsyncPageable<VirtualMachineScaleSetExtension> ListAsync(string resourceGroupName, string vmScale
 87        {
 288            if (resourceGroupName == null)
 89            {
 090                throw new ArgumentNullException(nameof(resourceGroupName));
 91            }
 292            if (vmScaleSetName == null)
 93            {
 094                throw new ArgumentNullException(nameof(vmScaleSetName));
 95            }
 96
 97            async Task<Page<VirtualMachineScaleSetExtension>> FirstPageFunc(int? pageSizeHint)
 98            {
 299                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List");
 2100                scope.Start();
 101                try
 102                {
 2103                    var response = await RestClient.ListAsync(resourceGroupName, vmScaleSetName, cancellationToken).Conf
 2104                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 105                }
 0106                catch (Exception e)
 107                {
 0108                    scope.Failed(e);
 0109                    throw;
 110                }
 2111            }
 112            async Task<Page<VirtualMachineScaleSetExtension>> NextPageFunc(string nextLink, int? pageSizeHint)
 113            {
 0114                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List");
 0115                scope.Start();
 116                try
 117                {
 0118                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, vmScaleSetName, cance
 0119                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 120                }
 0121                catch (Exception e)
 122                {
 0123                    scope.Failed(e);
 0124                    throw;
 125                }
 0126            }
 2127            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 128        }
 129
 130        /// <summary> Gets a list of all extensions in a VM scale set. </summary>
 131        /// <param name="resourceGroupName"> The name of the resource group. </param>
 132        /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param>
 133        /// <param name="cancellationToken"> The cancellation token to use. </param>
 134        public virtual Pageable<VirtualMachineScaleSetExtension> List(string resourceGroupName, string vmScaleSetName, C
 135        {
 2136            if (resourceGroupName == null)
 137            {
 0138                throw new ArgumentNullException(nameof(resourceGroupName));
 139            }
 2140            if (vmScaleSetName == null)
 141            {
 0142                throw new ArgumentNullException(nameof(vmScaleSetName));
 143            }
 144
 145            Page<VirtualMachineScaleSetExtension> FirstPageFunc(int? pageSizeHint)
 146            {
 2147                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List");
 2148                scope.Start();
 149                try
 150                {
 2151                    var response = RestClient.List(resourceGroupName, vmScaleSetName, cancellationToken);
 2152                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 153                }
 0154                catch (Exception e)
 155                {
 0156                    scope.Failed(e);
 0157                    throw;
 158                }
 2159            }
 160            Page<VirtualMachineScaleSetExtension> NextPageFunc(string nextLink, int? pageSizeHint)
 161            {
 0162                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List");
 0163                scope.Start();
 164                try
 165                {
 0166                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, vmScaleSetName, cancellationToke
 0167                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 168                }
 0169                catch (Exception e)
 170                {
 0171                    scope.Failed(e);
 0172                    throw;
 173                }
 0174            }
 2175            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 176        }
 177
 178        /// <summary> The operation to create or update an extension. </summary>
 179        /// <param name="resourceGroupName"> The name of the resource group. </param>
 180        /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be create or updated. 
 181        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 182        /// <param name="extensionParameters"> Parameters supplied to the Create VM scale set Extension operation. </par
 183        /// <param name="cancellationToken"> The cancellation token to use. </param>
 184        public virtual async Task<VirtualMachineScaleSetExtensionsCreateOrUpdateOperation> StartCreateOrUpdateAsync(stri
 185        {
 4186            if (resourceGroupName == null)
 187            {
 0188                throw new ArgumentNullException(nameof(resourceGroupName));
 189            }
 4190            if (vmScaleSetName == null)
 191            {
 0192                throw new ArgumentNullException(nameof(vmScaleSetName));
 193            }
 4194            if (vmssExtensionName == null)
 195            {
 0196                throw new ArgumentNullException(nameof(vmssExtensionName));
 197            }
 4198            if (extensionParameters == null)
 199            {
 0200                throw new ArgumentNullException(nameof(extensionParameters));
 201            }
 202
 4203            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartCreateOrUp
 4204            scope.Start();
 205            try
 206            {
 4207                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExten
 4208                return new VirtualMachineScaleSetExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCl
 209            }
 0210            catch (Exception e)
 211            {
 0212                scope.Failed(e);
 0213                throw;
 214            }
 4215        }
 216
 217        /// <summary> The operation to create or update an extension. </summary>
 218        /// <param name="resourceGroupName"> The name of the resource group. </param>
 219        /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be create or updated. 
 220        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 221        /// <param name="extensionParameters"> Parameters supplied to the Create VM scale set Extension operation. </par
 222        /// <param name="cancellationToken"> The cancellation token to use. </param>
 223        public virtual VirtualMachineScaleSetExtensionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupN
 224        {
 4225            if (resourceGroupName == null)
 226            {
 0227                throw new ArgumentNullException(nameof(resourceGroupName));
 228            }
 4229            if (vmScaleSetName == null)
 230            {
 0231                throw new ArgumentNullException(nameof(vmScaleSetName));
 232            }
 4233            if (vmssExtensionName == null)
 234            {
 0235                throw new ArgumentNullException(nameof(vmssExtensionName));
 236            }
 4237            if (extensionParameters == null)
 238            {
 0239                throw new ArgumentNullException(nameof(extensionParameters));
 240            }
 241
 4242            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartCreateOrUp
 4243            scope.Start();
 244            try
 245            {
 4246                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vmScaleSetName, vmssExtensionName, e
 4247                return new VirtualMachineScaleSetExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCl
 248            }
 0249            catch (Exception e)
 250            {
 0251                scope.Failed(e);
 0252                throw;
 253            }
 4254        }
 255
 256        /// <summary> The operation to update an extension. </summary>
 257        /// <param name="resourceGroupName"> The name of the resource group. </param>
 258        /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be updated. </param>
 259        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 260        /// <param name="extensionParameters"> Parameters supplied to the Update VM scale set Extension operation. </par
 261        /// <param name="cancellationToken"> The cancellation token to use. </param>
 262        public virtual async Task<VirtualMachineScaleSetExtensionsUpdateOperation> StartUpdateAsync(string resourceGroup
 263        {
 0264            if (resourceGroupName == null)
 265            {
 0266                throw new ArgumentNullException(nameof(resourceGroupName));
 267            }
 0268            if (vmScaleSetName == null)
 269            {
 0270                throw new ArgumentNullException(nameof(vmScaleSetName));
 271            }
 0272            if (vmssExtensionName == null)
 273            {
 0274                throw new ArgumentNullException(nameof(vmssExtensionName));
 275            }
 0276            if (extensionParameters == null)
 277            {
 0278                throw new ArgumentNullException(nameof(extensionParameters));
 279            }
 280
 0281            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartUpdate");
 0282            scope.Start();
 283            try
 284            {
 0285                var originalResponse = await RestClient.UpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName
 0286                return new VirtualMachineScaleSetExtensionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 287            }
 0288            catch (Exception e)
 289            {
 0290                scope.Failed(e);
 0291                throw;
 292            }
 0293        }
 294
 295        /// <summary> The operation to update an extension. </summary>
 296        /// <param name="resourceGroupName"> The name of the resource group. </param>
 297        /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be updated. </param>
 298        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 299        /// <param name="extensionParameters"> Parameters supplied to the Update VM scale set Extension operation. </par
 300        /// <param name="cancellationToken"> The cancellation token to use. </param>
 301        public virtual VirtualMachineScaleSetExtensionsUpdateOperation StartUpdate(string resourceGroupName, string vmSc
 302        {
 0303            if (resourceGroupName == null)
 304            {
 0305                throw new ArgumentNullException(nameof(resourceGroupName));
 306            }
 0307            if (vmScaleSetName == null)
 308            {
 0309                throw new ArgumentNullException(nameof(vmScaleSetName));
 310            }
 0311            if (vmssExtensionName == null)
 312            {
 0313                throw new ArgumentNullException(nameof(vmssExtensionName));
 314            }
 0315            if (extensionParameters == null)
 316            {
 0317                throw new ArgumentNullException(nameof(extensionParameters));
 318            }
 319
 0320            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartUpdate");
 0321            scope.Start();
 322            try
 323            {
 0324                var originalResponse = RestClient.Update(resourceGroupName, vmScaleSetName, vmssExtensionName, extension
 0325                return new VirtualMachineScaleSetExtensionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 326            }
 0327            catch (Exception e)
 328            {
 0329                scope.Failed(e);
 0330                throw;
 331            }
 0332        }
 333
 334        /// <summary> The operation to delete the extension. </summary>
 335        /// <param name="resourceGroupName"> The name of the resource group. </param>
 336        /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be deleted. </param>
 337        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 338        /// <param name="cancellationToken"> The cancellation token to use. </param>
 339        public virtual async Task<VirtualMachineScaleSetExtensionsDeleteOperation> StartDeleteAsync(string resourceGroup
 340        {
 0341            if (resourceGroupName == null)
 342            {
 0343                throw new ArgumentNullException(nameof(resourceGroupName));
 344            }
 0345            if (vmScaleSetName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(vmScaleSetName));
 348            }
 0349            if (vmssExtensionName == null)
 350            {
 0351                throw new ArgumentNullException(nameof(vmssExtensionName));
 352            }
 353
 0354            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartDelete");
 0355            scope.Start();
 356            try
 357            {
 0358                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName
 0359                return new VirtualMachineScaleSetExtensionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 360            }
 0361            catch (Exception e)
 362            {
 0363                scope.Failed(e);
 0364                throw;
 365            }
 0366        }
 367
 368        /// <summary> The operation to delete the extension. </summary>
 369        /// <param name="resourceGroupName"> The name of the resource group. </param>
 370        /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be deleted. </param>
 371        /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param>
 372        /// <param name="cancellationToken"> The cancellation token to use. </param>
 373        public virtual VirtualMachineScaleSetExtensionsDeleteOperation StartDelete(string resourceGroupName, string vmSc
 374        {
 0375            if (resourceGroupName == null)
 376            {
 0377                throw new ArgumentNullException(nameof(resourceGroupName));
 378            }
 0379            if (vmScaleSetName == null)
 380            {
 0381                throw new ArgumentNullException(nameof(vmScaleSetName));
 382            }
 0383            if (vmssExtensionName == null)
 384            {
 0385                throw new ArgumentNullException(nameof(vmssExtensionName));
 386            }
 387
 0388            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartDelete");
 0389            scope.Start();
 390            try
 391            {
 0392                var originalResponse = RestClient.Delete(resourceGroupName, vmScaleSetName, vmssExtensionName, cancellat
 0393                return new VirtualMachineScaleSetExtensionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 394            }
 0395            catch (Exception e)
 396            {
 0397                scope.Failed(e);
 0398                throw;
 399            }
 0400        }
 401    }
 402}