< Summary

Class:Azure.ResourceManager.Compute.DiskEncryptionSetsOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\DiskEncryptionSetsOperations.cs
Covered lines:94
Uncovered lines:80
Coverable lines:174
Total lines:432
Line coverage:54% (94 of 174)
Covered branches:18
Total branches:36
Branch coverage:50% (18 of 36)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetAsync()-100%100%
Get(...)-100%100%
ListByResourceGroupAsync(...)-36.84%50%
<ListByResourceGroupAsync()-62.5%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-36.84%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
ListAsync(...)-100%100%
List(...)-100%100%
StartCreateOrUpdateAsync()-57.14%50%
StartCreateOrUpdate(...)-57.14%50%
StartUpdateAsync()-57.14%50%
StartUpdate(...)-57.14%50%
StartDeleteAsync()-58.33%50%
StartDelete(...)-58.33%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\DiskEncryptionSetsOperations.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 DiskEncryptionSets service client. </summary>
 19    public partial class DiskEncryptionSetsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 10823        internal DiskEncryptionSetsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of DiskEncryptionSetsOperations for mocking. </summary>
 39625        protected DiskEncryptionSetsOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of DiskEncryptionSetsOperations. </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 DiskEncryptionSetsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscri
 34        {
 39635            RestClient = new DiskEncryptionSetsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Gets information about a disk encryption set. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<DiskEncryptionSet>> GetAsync(string resourceGroupName, string diskEncryptionS
 45        {
 446            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.Get");
 447            scope.Start();
 48            try
 49            {
 450                return await RestClient.GetAsync(resourceGroupName, diskEncryptionSetName, cancellationToken).ConfigureA
 51            }
 252            catch (Exception e)
 53            {
 254                scope.Failed(e);
 255                throw;
 56            }
 257        }
 58
 59        /// <summary> Gets information about a disk encryption set. </summary>
 60        /// <param name="resourceGroupName"> The name of the resource group. </param>
 61        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<DiskEncryptionSet> Get(string resourceGroupName, string diskEncryptionSetName, Cancellat
 64        {
 465            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.Get");
 466            scope.Start();
 67            try
 68            {
 469                return RestClient.Get(resourceGroupName, diskEncryptionSetName, cancellationToken);
 70            }
 271            catch (Exception e)
 72            {
 273                scope.Failed(e);
 274                throw;
 75            }
 276        }
 77
 78        /// <summary> Lists all the disk encryption sets under a resource group. </summary>
 79        /// <param name="resourceGroupName"> The name of the resource group. </param>
 80        /// <param name="cancellationToken"> The cancellation token to use. </param>
 81        public virtual AsyncPageable<DiskEncryptionSet> ListByResourceGroupAsync(string resourceGroupName, CancellationT
 82        {
 483            if (resourceGroupName == null)
 84            {
 085                throw new ArgumentNullException(nameof(resourceGroupName));
 86            }
 87
 88            async Task<Page<DiskEncryptionSet>> FirstPageFunc(int? pageSizeHint)
 89            {
 490                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.ListByResourceGroup");
 491                scope.Start();
 92                try
 93                {
 494                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 495                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 96                }
 097                catch (Exception e)
 98                {
 099                    scope.Failed(e);
 0100                    throw;
 101                }
 4102            }
 103            async Task<Page<DiskEncryptionSet>> NextPageFunc(string nextLink, int? pageSizeHint)
 104            {
 0105                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.ListByResourceGroup");
 0106                scope.Start();
 107                try
 108                {
 0109                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0110                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 111                }
 0112                catch (Exception e)
 113                {
 0114                    scope.Failed(e);
 0115                    throw;
 116                }
 0117            }
 4118            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 119        }
 120
 121        /// <summary> Lists all the disk encryption sets under a resource group. </summary>
 122        /// <param name="resourceGroupName"> The name of the resource group. </param>
 123        /// <param name="cancellationToken"> The cancellation token to use. </param>
 124        public virtual Pageable<DiskEncryptionSet> ListByResourceGroup(string resourceGroupName, CancellationToken cance
 125        {
 4126            if (resourceGroupName == null)
 127            {
 0128                throw new ArgumentNullException(nameof(resourceGroupName));
 129            }
 130
 131            Page<DiskEncryptionSet> FirstPageFunc(int? pageSizeHint)
 132            {
 4133                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.ListByResourceGroup");
 4134                scope.Start();
 135                try
 136                {
 4137                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 4138                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 139                }
 0140                catch (Exception e)
 141                {
 0142                    scope.Failed(e);
 0143                    throw;
 144                }
 4145            }
 146            Page<DiskEncryptionSet> NextPageFunc(string nextLink, int? pageSizeHint)
 147            {
 0148                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.ListByResourceGroup");
 0149                scope.Start();
 150                try
 151                {
 0152                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0153                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 154                }
 0155                catch (Exception e)
 156                {
 0157                    scope.Failed(e);
 0158                    throw;
 159                }
 0160            }
 4161            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 162        }
 163
 164        /// <summary> Lists all the disk encryption sets under a subscription. </summary>
 165        /// <param name="cancellationToken"> The cancellation token to use. </param>
 166        public virtual AsyncPageable<DiskEncryptionSet> ListAsync(CancellationToken cancellationToken = default)
 167        {
 168            async Task<Page<DiskEncryptionSet>> FirstPageFunc(int? pageSizeHint)
 169            {
 2170                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.List");
 2171                scope.Start();
 172                try
 173                {
 2174                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 2175                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 176                }
 0177                catch (Exception e)
 178                {
 0179                    scope.Failed(e);
 0180                    throw;
 181                }
 2182            }
 183            async Task<Page<DiskEncryptionSet>> NextPageFunc(string nextLink, int? pageSizeHint)
 184            {
 0185                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.List");
 0186                scope.Start();
 187                try
 188                {
 0189                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0190                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 191                }
 0192                catch (Exception e)
 193                {
 0194                    scope.Failed(e);
 0195                    throw;
 196                }
 0197            }
 2198            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 199        }
 200
 201        /// <summary> Lists all the disk encryption sets under a subscription. </summary>
 202        /// <param name="cancellationToken"> The cancellation token to use. </param>
 203        public virtual Pageable<DiskEncryptionSet> List(CancellationToken cancellationToken = default)
 204        {
 205            Page<DiskEncryptionSet> FirstPageFunc(int? pageSizeHint)
 206            {
 2207                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.List");
 2208                scope.Start();
 209                try
 210                {
 2211                    var response = RestClient.List(cancellationToken);
 2212                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 213                }
 0214                catch (Exception e)
 215                {
 0216                    scope.Failed(e);
 0217                    throw;
 218                }
 2219            }
 220            Page<DiskEncryptionSet> NextPageFunc(string nextLink, int? pageSizeHint)
 221            {
 0222                using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.List");
 0223                scope.Start();
 224                try
 225                {
 0226                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0227                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 228                }
 0229                catch (Exception e)
 230                {
 0231                    scope.Failed(e);
 0232                    throw;
 233                }
 0234            }
 2235            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 236        }
 237
 238        /// <summary> Creates or updates a disk encryption set. </summary>
 239        /// <param name="resourceGroupName"> The name of the resource group. </param>
 240        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 241        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Put disk encryption 
 242        /// <param name="cancellationToken"> The cancellation token to use. </param>
 243        public virtual async Task<DiskEncryptionSetsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGro
 244        {
 10245            if (resourceGroupName == null)
 246            {
 0247                throw new ArgumentNullException(nameof(resourceGroupName));
 248            }
 10249            if (diskEncryptionSetName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 252            }
 10253            if (diskEncryptionSet == null)
 254            {
 0255                throw new ArgumentNullException(nameof(diskEncryptionSet));
 256            }
 257
 10258            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.StartCreateOrUpdate");
 10259            scope.Start();
 260            try
 261            {
 10262                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, di
 10263                return new DiskEncryptionSetsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCre
 264            }
 0265            catch (Exception e)
 266            {
 0267                scope.Failed(e);
 0268                throw;
 269            }
 10270        }
 271
 272        /// <summary> Creates or updates a disk encryption set. </summary>
 273        /// <param name="resourceGroupName"> The name of the resource group. </param>
 274        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 275        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Put disk encryption 
 276        /// <param name="cancellationToken"> The cancellation token to use. </param>
 277        public virtual DiskEncryptionSetsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string di
 278        {
 10279            if (resourceGroupName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(resourceGroupName));
 282            }
 10283            if (diskEncryptionSetName == null)
 284            {
 0285                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 286            }
 10287            if (diskEncryptionSet == null)
 288            {
 0289                throw new ArgumentNullException(nameof(diskEncryptionSet));
 290            }
 291
 10292            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.StartCreateOrUpdate");
 10293            scope.Start();
 294            try
 295            {
 10296                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, diskEncryptionSetName, diskEncryptio
 10297                return new DiskEncryptionSetsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCre
 298            }
 0299            catch (Exception e)
 300            {
 0301                scope.Failed(e);
 0302                throw;
 303            }
 10304        }
 305
 306        /// <summary> Updates (patches) a disk encryption set. </summary>
 307        /// <param name="resourceGroupName"> The name of the resource group. </param>
 308        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 309        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Patch disk encryptio
 310        /// <param name="cancellationToken"> The cancellation token to use. </param>
 311        public virtual async Task<DiskEncryptionSetsUpdateOperation> StartUpdateAsync(string resourceGroupName, string d
 312        {
 2313            if (resourceGroupName == null)
 314            {
 0315                throw new ArgumentNullException(nameof(resourceGroupName));
 316            }
 2317            if (diskEncryptionSetName == null)
 318            {
 0319                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 320            }
 2321            if (diskEncryptionSet == null)
 322            {
 0323                throw new ArgumentNullException(nameof(diskEncryptionSet));
 324            }
 325
 2326            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.StartUpdate");
 2327            scope.Start();
 328            try
 329            {
 2330                var originalResponse = await RestClient.UpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryp
 2331                return new DiskEncryptionSetsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateReque
 332            }
 0333            catch (Exception e)
 334            {
 0335                scope.Failed(e);
 0336                throw;
 337            }
 2338        }
 339
 340        /// <summary> Updates (patches) a disk encryption set. </summary>
 341        /// <param name="resourceGroupName"> The name of the resource group. </param>
 342        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 343        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Patch disk encryptio
 344        /// <param name="cancellationToken"> The cancellation token to use. </param>
 345        public virtual DiskEncryptionSetsUpdateOperation StartUpdate(string resourceGroupName, string diskEncryptionSetN
 346        {
 2347            if (resourceGroupName == null)
 348            {
 0349                throw new ArgumentNullException(nameof(resourceGroupName));
 350            }
 2351            if (diskEncryptionSetName == null)
 352            {
 0353                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 354            }
 2355            if (diskEncryptionSet == null)
 356            {
 0357                throw new ArgumentNullException(nameof(diskEncryptionSet));
 358            }
 359
 2360            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.StartUpdate");
 2361            scope.Start();
 362            try
 363            {
 2364                var originalResponse = RestClient.Update(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, ca
 2365                return new DiskEncryptionSetsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateReque
 366            }
 0367            catch (Exception e)
 368            {
 0369                scope.Failed(e);
 0370                throw;
 371            }
 2372        }
 373
 374        /// <summary> Deletes a disk encryption set. </summary>
 375        /// <param name="resourceGroupName"> The name of the resource group. </param>
 376        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 377        /// <param name="cancellationToken"> The cancellation token to use. </param>
 378        public virtual async Task<DiskEncryptionSetsDeleteOperation> StartDeleteAsync(string resourceGroupName, string d
 379        {
 10380            if (resourceGroupName == null)
 381            {
 0382                throw new ArgumentNullException(nameof(resourceGroupName));
 383            }
 10384            if (diskEncryptionSetName == null)
 385            {
 0386                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 387            }
 388
 10389            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.StartDelete");
 10390            scope.Start();
 391            try
 392            {
 10393                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, diskEncryptionSetName, cancellati
 10394                return new DiskEncryptionSetsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReque
 395            }
 0396            catch (Exception e)
 397            {
 0398                scope.Failed(e);
 0399                throw;
 400            }
 10401        }
 402
 403        /// <summary> Deletes a disk encryption set. </summary>
 404        /// <param name="resourceGroupName"> The name of the resource group. </param>
 405        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 406        /// <param name="cancellationToken"> The cancellation token to use. </param>
 407        public virtual DiskEncryptionSetsDeleteOperation StartDelete(string resourceGroupName, string diskEncryptionSetN
 408        {
 10409            if (resourceGroupName == null)
 410            {
 0411                throw new ArgumentNullException(nameof(resourceGroupName));
 412            }
 10413            if (diskEncryptionSetName == null)
 414            {
 0415                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 416            }
 417
 10418            using var scope = _clientDiagnostics.CreateScope("DiskEncryptionSetsOperations.StartDelete");
 10419            scope.Start();
 420            try
 421            {
 10422                var originalResponse = RestClient.Delete(resourceGroupName, diskEncryptionSetName, cancellationToken);
 10423                return new DiskEncryptionSetsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReque
 424            }
 0425            catch (Exception e)
 426            {
 0427                scope.Failed(e);
 0428                throw;
 429            }
 10430        }
 431    }
 432}