< Summary

Class:Azure.ResourceManager.KeyVault.VaultsOperations
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\VaultsOperations.cs
Covered lines:112
Uncovered lines:172
Coverable lines:284
Total lines:719
Line coverage:39.4% (112 of 284)
Covered branches:12
Total branches:24
Branch coverage:50% (12 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
UpdateAsync()-0%100%
Update(...)-0%100%
DeleteAsync()-57.14%100%
Delete(...)-57.14%100%
GetAsync()-100%100%
Get(...)-100%100%
UpdateAccessPolicyAsync()-0%100%
UpdateAccessPolicy(...)-0%100%
GetDeletedAsync()-100%100%
GetDeleted(...)-100%100%
CheckNameAvailabilityAsync()-0%100%
CheckNameAvailability(...)-0%100%
ListByResourceGroupAsync(...)-63.16%50%
<ListByResourceGroupAsync()-62.5%100%
<ListByResourceGroupAsync()-62.5%100%
ListByResourceGroup(...)-63.16%50%
<ListBySubscriptionAsync()-0%100%
<ListBySubscriptionAsync()-0%100%
ListBySubscriptionAsync(...)-0%100%
ListBySubscription(...)-0%100%
<ListDeletedAsync()-62.5%100%
<ListDeletedAsync()-0%100%
ListDeletedAsync(...)-100%100%
ListDeleted(...)-100%100%
<ListAsync()-0%100%
<ListAsync()-0%100%
ListAsync(...)-100%100%
List(...)-100%100%
StartCreateOrUpdateAsync()-57.14%50%
StartCreateOrUpdate(...)-57.14%50%
StartPurgeDeletedAsync()-58.33%50%
StartPurgeDeleted(...)-58.33%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\VaultsOperations.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.KeyVault.Models;
 15
 16namespace Azure.ResourceManager.KeyVault
 17{
 18    /// <summary> The Vaults service client. </summary>
 19    public partial class VaultsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 24023        internal VaultsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of VaultsOperations for mocking. </summary>
 2425        protected VaultsOperations()
 26        {
 2427        }
 28        /// <summary> Initializes a new instance of VaultsOperations. </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>
 33        /// <param name="apiVersion"> Api Version. </param>
 2434        internal VaultsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri
 35        {
 2436            RestClient = new VaultsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion);
 2437            _clientDiagnostics = clientDiagnostics;
 2438            _pipeline = pipeline;
 2439        }
 40
 41        /// <summary> Update a key vault in the specified subscription. </summary>
 42        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 43        /// <param name="vaultName"> Name of the vault. </param>
 44        /// <param name="parameters"> Parameters to patch the vault. </param>
 45        /// <param name="cancellationToken"> The cancellation token to use. </param>
 46        public virtual async Task<Response<Vault>> UpdateAsync(string resourceGroupName, string vaultName, VaultPatchPar
 47        {
 048            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Update");
 049            scope.Start();
 50            try
 51            {
 052                return await RestClient.UpdateAsync(resourceGroupName, vaultName, parameters, cancellationToken).Configu
 53            }
 054            catch (Exception e)
 55            {
 056                scope.Failed(e);
 057                throw;
 58            }
 059        }
 60
 61        /// <summary> Update a key vault in the specified subscription. </summary>
 62        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 63        /// <param name="vaultName"> Name of the vault. </param>
 64        /// <param name="parameters"> Parameters to patch the vault. </param>
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public virtual Response<Vault> Update(string resourceGroupName, string vaultName, VaultPatchParameters parameter
 67        {
 068            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Update");
 069            scope.Start();
 70            try
 71            {
 072                return RestClient.Update(resourceGroupName, vaultName, parameters, cancellationToken);
 73            }
 074            catch (Exception e)
 75            {
 076                scope.Failed(e);
 077                throw;
 78            }
 079        }
 80
 81        /// <summary> Deletes the specified Azure key vault. </summary>
 82        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 83        /// <param name="vaultName"> The name of the vault to delete. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response> DeleteAsync(string resourceGroupName, string vaultName, CancellationToken ca
 86        {
 2487            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Delete");
 2488            scope.Start();
 89            try
 90            {
 2491                return await RestClient.DeleteAsync(resourceGroupName, vaultName, cancellationToken).ConfigureAwait(fals
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 2498        }
 99
 100        /// <summary> Deletes the specified Azure key vault. </summary>
 101        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 102        /// <param name="vaultName"> The name of the vault to delete. </param>
 103        /// <param name="cancellationToken"> The cancellation token to use. </param>
 104        public virtual Response Delete(string resourceGroupName, string vaultName, CancellationToken cancellationToken =
 105        {
 24106            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Delete");
 24107            scope.Start();
 108            try
 109            {
 24110                return RestClient.Delete(resourceGroupName, vaultName, cancellationToken);
 111            }
 0112            catch (Exception e)
 113            {
 0114                scope.Failed(e);
 0115                throw;
 116            }
 24117        }
 118
 119        /// <summary> Gets the specified Azure key vault. </summary>
 120        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 121        /// <param name="vaultName"> The name of the vault. </param>
 122        /// <param name="cancellationToken"> The cancellation token to use. </param>
 123        public virtual async Task<Response<Vault>> GetAsync(string resourceGroupName, string vaultName, CancellationToke
 124        {
 14125            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Get");
 14126            scope.Start();
 127            try
 128            {
 14129                return await RestClient.GetAsync(resourceGroupName, vaultName, cancellationToken).ConfigureAwait(false);
 130            }
 6131            catch (Exception e)
 132            {
 6133                scope.Failed(e);
 6134                throw;
 135            }
 8136        }
 137
 138        /// <summary> Gets the specified Azure key vault. </summary>
 139        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 140        /// <param name="vaultName"> The name of the vault. </param>
 141        /// <param name="cancellationToken"> The cancellation token to use. </param>
 142        public virtual Response<Vault> Get(string resourceGroupName, string vaultName, CancellationToken cancellationTok
 143        {
 14144            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Get");
 14145            scope.Start();
 146            try
 147            {
 14148                return RestClient.Get(resourceGroupName, vaultName, cancellationToken);
 149            }
 6150            catch (Exception e)
 151            {
 6152                scope.Failed(e);
 6153                throw;
 154            }
 8155        }
 156
 157        /// <summary> Update access policies in a key vault in the specified subscription. </summary>
 158        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 159        /// <param name="vaultName"> Name of the vault. </param>
 160        /// <param name="operationKind"> Name of the operation. </param>
 161        /// <param name="parameters"> Access policy to merge into the vault. </param>
 162        /// <param name="cancellationToken"> The cancellation token to use. </param>
 163        public virtual async Task<Response<VaultAccessPolicyParameters>> UpdateAccessPolicyAsync(string resourceGroupNam
 164        {
 0165            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.UpdateAccessPolicy");
 0166            scope.Start();
 167            try
 168            {
 0169                return await RestClient.UpdateAccessPolicyAsync(resourceGroupName, vaultName, operationKind, parameters,
 170            }
 0171            catch (Exception e)
 172            {
 0173                scope.Failed(e);
 0174                throw;
 175            }
 0176        }
 177
 178        /// <summary> Update access policies in a key vault in the specified subscription. </summary>
 179        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 180        /// <param name="vaultName"> Name of the vault. </param>
 181        /// <param name="operationKind"> Name of the operation. </param>
 182        /// <param name="parameters"> Access policy to merge into the vault. </param>
 183        /// <param name="cancellationToken"> The cancellation token to use. </param>
 184        public virtual Response<VaultAccessPolicyParameters> UpdateAccessPolicy(string resourceGroupName, string vaultNa
 185        {
 0186            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.UpdateAccessPolicy");
 0187            scope.Start();
 188            try
 189            {
 0190                return RestClient.UpdateAccessPolicy(resourceGroupName, vaultName, operationKind, parameters, cancellati
 191            }
 0192            catch (Exception e)
 193            {
 0194                scope.Failed(e);
 0195                throw;
 196            }
 0197        }
 198
 199        /// <summary> Gets the deleted Azure key vault. </summary>
 200        /// <param name="vaultName"> The name of the vault. </param>
 201        /// <param name="location"> The location of the deleted vault. </param>
 202        /// <param name="cancellationToken"> The cancellation token to use. </param>
 203        public virtual async Task<Response<DeletedVault>> GetDeletedAsync(string vaultName, string location, Cancellatio
 204        {
 12205            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.GetDeleted");
 12206            scope.Start();
 207            try
 208            {
 12209                return await RestClient.GetDeletedAsync(vaultName, location, cancellationToken).ConfigureAwait(false);
 210            }
 6211            catch (Exception e)
 212            {
 6213                scope.Failed(e);
 6214                throw;
 215            }
 6216        }
 217
 218        /// <summary> Gets the deleted Azure key vault. </summary>
 219        /// <param name="vaultName"> The name of the vault. </param>
 220        /// <param name="location"> The location of the deleted vault. </param>
 221        /// <param name="cancellationToken"> The cancellation token to use. </param>
 222        public virtual Response<DeletedVault> GetDeleted(string vaultName, string location, CancellationToken cancellati
 223        {
 12224            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.GetDeleted");
 12225            scope.Start();
 226            try
 227            {
 12228                return RestClient.GetDeleted(vaultName, location, cancellationToken);
 229            }
 6230            catch (Exception e)
 231            {
 6232                scope.Failed(e);
 6233                throw;
 234            }
 6235        }
 236
 237        /// <summary> Checks that the vault name is valid and is not already in use. </summary>
 238        /// <param name="vaultName"> The name of the vault. </param>
 239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 240        public virtual async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(VaultCheckNameAvaila
 241        {
 0242            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.CheckNameAvailability");
 0243            scope.Start();
 244            try
 245            {
 0246                return await RestClient.CheckNameAvailabilityAsync(vaultName, cancellationToken).ConfigureAwait(false);
 247            }
 0248            catch (Exception e)
 249            {
 0250                scope.Failed(e);
 0251                throw;
 252            }
 0253        }
 254
 255        /// <summary> Checks that the vault name is valid and is not already in use. </summary>
 256        /// <param name="vaultName"> The name of the vault. </param>
 257        /// <param name="cancellationToken"> The cancellation token to use. </param>
 258        public virtual Response<CheckNameAvailabilityResult> CheckNameAvailability(VaultCheckNameAvailabilityParameters 
 259        {
 0260            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.CheckNameAvailability");
 0261            scope.Start();
 262            try
 263            {
 0264                return RestClient.CheckNameAvailability(vaultName, cancellationToken);
 265            }
 0266            catch (Exception e)
 267            {
 0268                scope.Failed(e);
 0269                throw;
 270            }
 0271        }
 272
 273        /// <summary> The List operation gets information about the vaults associated with the subscription and within t
 274        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 275        /// <param name="top"> Maximum number of results to return. </param>
 276        /// <param name="cancellationToken"> The cancellation token to use. </param>
 277        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception>
 278        public virtual AsyncPageable<Vault> ListByResourceGroupAsync(string resourceGroupName, int? top = null, Cancella
 279        {
 2280            if (resourceGroupName == null)
 281            {
 0282                throw new ArgumentNullException(nameof(resourceGroupName));
 283            }
 284
 285            async Task<Page<Vault>> FirstPageFunc(int? pageSizeHint)
 286            {
 2287                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup");
 2288                scope.Start();
 289                try
 290                {
 2291                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, top, cancellationToken).
 2292                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 293                }
 0294                catch (Exception e)
 295                {
 0296                    scope.Failed(e);
 0297                    throw;
 298                }
 2299            }
 300            async Task<Page<Vault>> NextPageFunc(string nextLink, int? pageSizeHint)
 301            {
 2302                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup");
 2303                scope.Start();
 304                try
 305                {
 2306                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, top, c
 2307                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 308                }
 0309                catch (Exception e)
 310                {
 0311                    scope.Failed(e);
 0312                    throw;
 313                }
 2314            }
 2315            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 316        }
 317
 318        /// <summary> The List operation gets information about the vaults associated with the subscription and within t
 319        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 320        /// <param name="top"> Maximum number of results to return. </param>
 321        /// <param name="cancellationToken"> The cancellation token to use. </param>
 322        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception>
 323        public virtual Pageable<Vault> ListByResourceGroup(string resourceGroupName, int? top = null, CancellationToken 
 324        {
 2325            if (resourceGroupName == null)
 326            {
 0327                throw new ArgumentNullException(nameof(resourceGroupName));
 328            }
 329
 330            Page<Vault> FirstPageFunc(int? pageSizeHint)
 331            {
 2332                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup");
 2333                scope.Start();
 334                try
 335                {
 2336                    var response = RestClient.ListByResourceGroup(resourceGroupName, top, cancellationToken);
 2337                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 338                }
 0339                catch (Exception e)
 340                {
 0341                    scope.Failed(e);
 0342                    throw;
 343                }
 2344            }
 345            Page<Vault> NextPageFunc(string nextLink, int? pageSizeHint)
 346            {
 2347                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup");
 2348                scope.Start();
 349                try
 350                {
 2351                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, top, cancellation
 2352                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 353                }
 0354                catch (Exception e)
 355                {
 0356                    scope.Failed(e);
 0357                    throw;
 358                }
 2359            }
 2360            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 361        }
 362
 363        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 364        /// <param name="top"> Maximum number of results to return. </param>
 365        /// <param name="cancellationToken"> The cancellation token to use. </param>
 366        public virtual AsyncPageable<Vault> ListBySubscriptionAsync(int? top = null, CancellationToken cancellationToken
 367        {
 368            async Task<Page<Vault>> FirstPageFunc(int? pageSizeHint)
 369            {
 0370                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription");
 0371                scope.Start();
 372                try
 373                {
 0374                    var response = await RestClient.ListBySubscriptionAsync(top, cancellationToken).ConfigureAwait(false
 0375                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 376                }
 0377                catch (Exception e)
 378                {
 0379                    scope.Failed(e);
 0380                    throw;
 381                }
 0382            }
 383            async Task<Page<Vault>> NextPageFunc(string nextLink, int? pageSizeHint)
 384            {
 0385                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription");
 0386                scope.Start();
 387                try
 388                {
 0389                    var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, top, cancellationToken).Co
 0390                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 391                }
 0392                catch (Exception e)
 393                {
 0394                    scope.Failed(e);
 0395                    throw;
 396                }
 0397            }
 0398            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 399        }
 400
 401        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 402        /// <param name="top"> Maximum number of results to return. </param>
 403        /// <param name="cancellationToken"> The cancellation token to use. </param>
 404        public virtual Pageable<Vault> ListBySubscription(int? top = null, CancellationToken cancellationToken = default
 405        {
 406            Page<Vault> FirstPageFunc(int? pageSizeHint)
 407            {
 0408                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription");
 0409                scope.Start();
 410                try
 411                {
 0412                    var response = RestClient.ListBySubscription(top, cancellationToken);
 0413                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 414                }
 0415                catch (Exception e)
 416                {
 0417                    scope.Failed(e);
 0418                    throw;
 419                }
 0420            }
 421            Page<Vault> NextPageFunc(string nextLink, int? pageSizeHint)
 422            {
 0423                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription");
 0424                scope.Start();
 425                try
 426                {
 0427                    var response = RestClient.ListBySubscriptionNextPage(nextLink, top, cancellationToken);
 0428                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 429                }
 0430                catch (Exception e)
 431                {
 0432                    scope.Failed(e);
 0433                    throw;
 434                }
 0435            }
 0436            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 437        }
 438
 439        /// <summary> Gets information about the deleted vaults in a subscription. </summary>
 440        /// <param name="cancellationToken"> The cancellation token to use. </param>
 441        public virtual AsyncPageable<DeletedVault> ListDeletedAsync(CancellationToken cancellationToken = default)
 442        {
 443            async Task<Page<DeletedVault>> FirstPageFunc(int? pageSizeHint)
 444            {
 2445                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted");
 2446                scope.Start();
 447                try
 448                {
 2449                    var response = await RestClient.ListDeletedAsync(cancellationToken).ConfigureAwait(false);
 2450                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 451                }
 0452                catch (Exception e)
 453                {
 0454                    scope.Failed(e);
 0455                    throw;
 456                }
 2457            }
 458            async Task<Page<DeletedVault>> NextPageFunc(string nextLink, int? pageSizeHint)
 459            {
 0460                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted");
 0461                scope.Start();
 462                try
 463                {
 0464                    var response = await RestClient.ListDeletedNextPageAsync(nextLink, cancellationToken).ConfigureAwait
 0465                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 466                }
 0467                catch (Exception e)
 468                {
 0469                    scope.Failed(e);
 0470                    throw;
 471                }
 0472            }
 2473            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 474        }
 475
 476        /// <summary> Gets information about the deleted vaults in a subscription. </summary>
 477        /// <param name="cancellationToken"> The cancellation token to use. </param>
 478        public virtual Pageable<DeletedVault> ListDeleted(CancellationToken cancellationToken = default)
 479        {
 480            Page<DeletedVault> FirstPageFunc(int? pageSizeHint)
 481            {
 2482                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted");
 2483                scope.Start();
 484                try
 485                {
 2486                    var response = RestClient.ListDeleted(cancellationToken);
 2487                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 488                }
 0489                catch (Exception e)
 490                {
 0491                    scope.Failed(e);
 0492                    throw;
 493                }
 2494            }
 495            Page<DeletedVault> NextPageFunc(string nextLink, int? pageSizeHint)
 496            {
 0497                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted");
 0498                scope.Start();
 499                try
 500                {
 0501                    var response = RestClient.ListDeletedNextPage(nextLink, cancellationToken);
 0502                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 503                }
 0504                catch (Exception e)
 505                {
 0506                    scope.Failed(e);
 0507                    throw;
 508                }
 0509            }
 2510            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 511        }
 512
 513        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 514        /// <param name="top"> Maximum number of results to return. </param>
 515        /// <param name="cancellationToken"> The cancellation token to use. </param>
 516        public virtual AsyncPageable<Resource> ListAsync(int? top = null, CancellationToken cancellationToken = default)
 517        {
 518            async Task<Page<Resource>> FirstPageFunc(int? pageSizeHint)
 519            {
 0520                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List");
 0521                scope.Start();
 522                try
 523                {
 0524                    var response = await RestClient.ListAsync(top, cancellationToken).ConfigureAwait(false);
 0525                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 526                }
 0527                catch (Exception e)
 528                {
 0529                    scope.Failed(e);
 0530                    throw;
 531                }
 0532            }
 533            async Task<Page<Resource>> NextPageFunc(string nextLink, int? pageSizeHint)
 534            {
 0535                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List");
 0536                scope.Start();
 537                try
 538                {
 0539                    var response = await RestClient.ListNextPageAsync(nextLink, top, cancellationToken).ConfigureAwait(f
 0540                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 541                }
 0542                catch (Exception e)
 543                {
 0544                    scope.Failed(e);
 0545                    throw;
 546                }
 0547            }
 2548            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 549        }
 550
 551        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 552        /// <param name="top"> Maximum number of results to return. </param>
 553        /// <param name="cancellationToken"> The cancellation token to use. </param>
 554        public virtual Pageable<Resource> List(int? top = null, CancellationToken cancellationToken = default)
 555        {
 556            Page<Resource> FirstPageFunc(int? pageSizeHint)
 557            {
 0558                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List");
 0559                scope.Start();
 560                try
 561                {
 0562                    var response = RestClient.List(top, cancellationToken);
 0563                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 564                }
 0565                catch (Exception e)
 566                {
 0567                    scope.Failed(e);
 0568                    throw;
 569                }
 0570            }
 571            Page<Resource> NextPageFunc(string nextLink, int? pageSizeHint)
 572            {
 0573                using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List");
 0574                scope.Start();
 575                try
 576                {
 0577                    var response = RestClient.ListNextPage(nextLink, top, cancellationToken);
 0578                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 579                }
 0580                catch (Exception e)
 581                {
 0582                    scope.Failed(e);
 0583                    throw;
 584                }
 0585            }
 2586            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 587        }
 588
 589        /// <summary> Create or update a key vault in the specified subscription. </summary>
 590        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 591        /// <param name="vaultName"> Name of the vault. </param>
 592        /// <param name="parameters"> Parameters to create or update the vault. </param>
 593        /// <param name="cancellationToken"> The cancellation token to use. </param>
 594        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 595        public virtual async Task<VaultsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName, stri
 596        {
 26597            if (resourceGroupName == null)
 598            {
 0599                throw new ArgumentNullException(nameof(resourceGroupName));
 600            }
 26601            if (vaultName == null)
 602            {
 0603                throw new ArgumentNullException(nameof(vaultName));
 604            }
 26605            if (parameters == null)
 606            {
 0607                throw new ArgumentNullException(nameof(parameters));
 608            }
 609
 26610            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartCreateOrUpdate");
 26611            scope.Start();
 612            try
 613            {
 26614                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vaultName, parameters, ca
 26615                return new VaultsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateR
 616            }
 0617            catch (Exception e)
 618            {
 0619                scope.Failed(e);
 0620                throw;
 621            }
 26622        }
 623
 624        /// <summary> Create or update a key vault in the specified subscription. </summary>
 625        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 626        /// <param name="vaultName"> Name of the vault. </param>
 627        /// <param name="parameters"> Parameters to create or update the vault. </param>
 628        /// <param name="cancellationToken"> The cancellation token to use. </param>
 629        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 630        public virtual VaultsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string vaultName, Vau
 631        {
 26632            if (resourceGroupName == null)
 633            {
 0634                throw new ArgumentNullException(nameof(resourceGroupName));
 635            }
 26636            if (vaultName == null)
 637            {
 0638                throw new ArgumentNullException(nameof(vaultName));
 639            }
 26640            if (parameters == null)
 641            {
 0642                throw new ArgumentNullException(nameof(parameters));
 643            }
 644
 26645            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartCreateOrUpdate");
 26646            scope.Start();
 647            try
 648            {
 26649                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vaultName, parameters, cancellationT
 26650                return new VaultsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateR
 651            }
 0652            catch (Exception e)
 653            {
 0654                scope.Failed(e);
 0655                throw;
 656            }
 26657        }
 658
 659        /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary>
 660        /// <param name="vaultName"> The name of the soft-deleted vault. </param>
 661        /// <param name="location"> The location of the soft-deleted vault. </param>
 662        /// <param name="cancellationToken"> The cancellation token to use. </param>
 663        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null
 664        public virtual async Task<VaultsPurgeDeletedOperation> StartPurgeDeletedAsync(string vaultName, string location,
 665        {
 6666            if (vaultName == null)
 667            {
 0668                throw new ArgumentNullException(nameof(vaultName));
 669            }
 6670            if (location == null)
 671            {
 0672                throw new ArgumentNullException(nameof(location));
 673            }
 674
 6675            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartPurgeDeleted");
 6676            scope.Start();
 677            try
 678            {
 6679                var originalResponse = await RestClient.PurgeDeletedAsync(vaultName, location, cancellationToken).Config
 6680                return new VaultsPurgeDeletedOperation(_clientDiagnostics, _pipeline, RestClient.CreatePurgeDeletedReque
 681            }
 0682            catch (Exception e)
 683            {
 0684                scope.Failed(e);
 0685                throw;
 686            }
 6687        }
 688
 689        /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary>
 690        /// <param name="vaultName"> The name of the soft-deleted vault. </param>
 691        /// <param name="location"> The location of the soft-deleted vault. </param>
 692        /// <param name="cancellationToken"> The cancellation token to use. </param>
 693        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null
 694        public virtual VaultsPurgeDeletedOperation StartPurgeDeleted(string vaultName, string location, CancellationToke
 695        {
 6696            if (vaultName == null)
 697            {
 0698                throw new ArgumentNullException(nameof(vaultName));
 699            }
 6700            if (location == null)
 701            {
 0702                throw new ArgumentNullException(nameof(location));
 703            }
 704
 6705            using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartPurgeDeleted");
 6706            scope.Start();
 707            try
 708            {
 6709                var originalResponse = RestClient.PurgeDeleted(vaultName, location, cancellationToken);
 6710                return new VaultsPurgeDeletedOperation(_clientDiagnostics, _pipeline, RestClient.CreatePurgeDeletedReque
 711            }
 0712            catch (Exception e)
 713            {
 0714                scope.Failed(e);
 0715                throw;
 716            }
 6717        }
 718    }
 719}