< Summary

Class:Azure.ResourceManager.KeyVault.VaultsRestOperations
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\VaultsRestOperations.cs
Covered lines:251
Uncovered lines:314
Coverable lines:565
Total lines:1260
Line coverage:44.4% (251 of 565)
Covered branches:57
Total branches:176
Branch coverage:32.3% (57 of 176)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-83.33%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-66.67%50%
CreateOrUpdate(...)-66.67%50%
CreateUpdateRequest(...)-0%100%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateGetRequest(...)-100%100%
GetAsync()-83.33%66.67%
Get(...)-83.33%66.67%
CreateUpdateAccessPolicyRequest(...)-0%100%
UpdateAccessPolicyAsync()-0%0%
UpdateAccessPolicy(...)-0%0%
CreateListByResourceGroupRequest(...)-100%100%
ListByResourceGroupAsync()-80%50%
ListByResourceGroup(...)-80%50%
CreateListBySubscriptionRequest(...)-0%0%
ListBySubscriptionAsync()-0%0%
ListBySubscription(...)-0%0%
CreateListDeletedRequest()-100%100%
ListDeletedAsync()-87.5%50%
ListDeleted(...)-87.5%50%
CreateGetDeletedRequest(...)-100%100%
GetDeletedAsync()-83.33%66.67%
GetDeleted(...)-83.33%66.67%
CreatePurgeDeletedRequest(...)-100%100%
PurgeDeletedAsync()-70%62.5%
PurgeDeleted(...)-70%62.5%
CreateListRequest(...)-0%0%
ListAsync()-0%0%
List(...)-0%0%
CreateCheckNameAvailabilityRequest(...)-0%100%
CheckNameAvailabilityAsync()-0%0%
CheckNameAvailability(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-100%100%
ListByResourceGroupNextPageAsync()-75%50%
ListByResourceGroupNextPage(...)-75%50%
CreateListBySubscriptionNextPageRequest(...)-0%100%
ListBySubscriptionNextPageAsync()-0%0%
ListBySubscriptionNextPage(...)-0%0%
CreateListDeletedNextPageRequest(...)-0%100%
ListDeletedNextPageAsync()-0%0%
ListDeletedNextPage(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\VaultsRestOperations.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.Text.Json;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Core;
 14using Azure.Core.Pipeline;
 15using Azure.ResourceManager.KeyVault.Models;
 16
 17namespace Azure.ResourceManager.KeyVault
 18{
 19    internal partial class VaultsRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private string apiVersion;
 24        private ClientDiagnostics _clientDiagnostics;
 25        private HttpPipeline _pipeline;
 26
 27        /// <summary> Initializes a new instance of VaultsRestOperations. </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>
 32        /// <param name="apiVersion"> Api Version. </param>
 33        /// <exception cref="ArgumentNullException"> <paramref name="subscriptionId"/> or <paramref name="apiVersion"/> 
 2434        public VaultsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, U
 35        {
 2436            if (subscriptionId == null)
 37            {
 038                throw new ArgumentNullException(nameof(subscriptionId));
 39            }
 2440            endpoint ??= new Uri("https://management.azure.com");
 2441            if (apiVersion == null)
 42            {
 043                throw new ArgumentNullException(nameof(apiVersion));
 44            }
 45
 2446            this.subscriptionId = subscriptionId;
 2447            this.endpoint = endpoint;
 2448            this.apiVersion = apiVersion;
 2449            _clientDiagnostics = clientDiagnostics;
 2450            _pipeline = pipeline;
 2451        }
 52
 53        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string vaultName, VaultCreateOrUpdate
 54        {
 10455            var message = _pipeline.CreateMessage();
 10456            var request = message.Request;
 10457            request.Method = RequestMethod.Put;
 10458            var uri = new RawRequestUriBuilder();
 10459            uri.Reset(endpoint);
 10460            uri.AppendPath("/subscriptions/", false);
 10461            uri.AppendPath(subscriptionId, true);
 10462            uri.AppendPath("/resourceGroups/", false);
 10463            uri.AppendPath(resourceGroupName, true);
 10464            uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false);
 10465            uri.AppendPath(vaultName, true);
 10466            uri.AppendQuery("api-version", apiVersion, true);
 10467            request.Uri = uri;
 10468            request.Headers.Add("Content-Type", "application/json");
 10469            var content = new Utf8JsonRequestContent();
 10470            content.JsonWriter.WriteObjectValue(parameters);
 10471            request.Content = content;
 10472            return message;
 73        }
 74
 75        /// <summary> Create or update a key vault in the specified subscription. </summary>
 76        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 77        /// <param name="vaultName"> Name of the vault. </param>
 78        /// <param name="parameters"> Parameters to create or update the vault. </param>
 79        /// <param name="cancellationToken"> The cancellation token to use. </param>
 80        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 81        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string vaultName, VaultCreateOrUpdateP
 82        {
 2683            if (resourceGroupName == null)
 84            {
 085                throw new ArgumentNullException(nameof(resourceGroupName));
 86            }
 2687            if (vaultName == null)
 88            {
 089                throw new ArgumentNullException(nameof(vaultName));
 90            }
 2691            if (parameters == null)
 92            {
 093                throw new ArgumentNullException(nameof(parameters));
 94            }
 95
 2696            using var message = CreateCreateOrUpdateRequest(resourceGroupName, vaultName, parameters);
 2697            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2698            switch (message.Response.Status)
 99            {
 100                case 200:
 101                case 201:
 26102                    return message.Response;
 103                default:
 0104                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 105            }
 26106        }
 107
 108        /// <summary> Create or update a key vault in the specified subscription. </summary>
 109        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 110        /// <param name="vaultName"> Name of the vault. </param>
 111        /// <param name="parameters"> Parameters to create or update the vault. </param>
 112        /// <param name="cancellationToken"> The cancellation token to use. </param>
 113        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 114        public Response CreateOrUpdate(string resourceGroupName, string vaultName, VaultCreateOrUpdateParameters paramet
 115        {
 26116            if (resourceGroupName == null)
 117            {
 0118                throw new ArgumentNullException(nameof(resourceGroupName));
 119            }
 26120            if (vaultName == null)
 121            {
 0122                throw new ArgumentNullException(nameof(vaultName));
 123            }
 26124            if (parameters == null)
 125            {
 0126                throw new ArgumentNullException(nameof(parameters));
 127            }
 128
 26129            using var message = CreateCreateOrUpdateRequest(resourceGroupName, vaultName, parameters);
 26130            _pipeline.Send(message, cancellationToken);
 26131            switch (message.Response.Status)
 132            {
 133                case 200:
 134                case 201:
 26135                    return message.Response;
 136                default:
 0137                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 138            }
 26139        }
 140
 141        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string vaultName, VaultPatchParameters parame
 142        {
 0143            var message = _pipeline.CreateMessage();
 0144            var request = message.Request;
 0145            request.Method = RequestMethod.Patch;
 0146            var uri = new RawRequestUriBuilder();
 0147            uri.Reset(endpoint);
 0148            uri.AppendPath("/subscriptions/", false);
 0149            uri.AppendPath(subscriptionId, true);
 0150            uri.AppendPath("/resourceGroups/", false);
 0151            uri.AppendPath(resourceGroupName, true);
 0152            uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false);
 0153            uri.AppendPath(vaultName, true);
 0154            uri.AppendQuery("api-version", apiVersion, true);
 0155            request.Uri = uri;
 0156            request.Headers.Add("Content-Type", "application/json");
 0157            var content = new Utf8JsonRequestContent();
 0158            content.JsonWriter.WriteObjectValue(parameters);
 0159            request.Content = content;
 0160            return message;
 161        }
 162
 163        /// <summary> Update a key vault in the specified subscription. </summary>
 164        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 165        /// <param name="vaultName"> Name of the vault. </param>
 166        /// <param name="parameters"> Parameters to patch the vault. </param>
 167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 168        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 169        public async Task<Response<Vault>> UpdateAsync(string resourceGroupName, string vaultName, VaultPatchParameters 
 170        {
 0171            if (resourceGroupName == null)
 172            {
 0173                throw new ArgumentNullException(nameof(resourceGroupName));
 174            }
 0175            if (vaultName == null)
 176            {
 0177                throw new ArgumentNullException(nameof(vaultName));
 178            }
 0179            if (parameters == null)
 180            {
 0181                throw new ArgumentNullException(nameof(parameters));
 182            }
 183
 0184            using var message = CreateUpdateRequest(resourceGroupName, vaultName, parameters);
 0185            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0186            switch (message.Response.Status)
 187            {
 188                case 200:
 189                case 201:
 190                    {
 191                        Vault value = default;
 0192                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0193                        value = Vault.DeserializeVault(document.RootElement);
 0194                        return Response.FromValue(value, message.Response);
 195                    }
 196                default:
 0197                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 198            }
 0199        }
 200
 201        /// <summary> Update a key vault in the specified subscription. </summary>
 202        /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param>
 203        /// <param name="vaultName"> Name of the vault. </param>
 204        /// <param name="parameters"> Parameters to patch the vault. </param>
 205        /// <param name="cancellationToken"> The cancellation token to use. </param>
 206        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 207        public Response<Vault> Update(string resourceGroupName, string vaultName, VaultPatchParameters parameters, Cance
 208        {
 0209            if (resourceGroupName == null)
 210            {
 0211                throw new ArgumentNullException(nameof(resourceGroupName));
 212            }
 0213            if (vaultName == null)
 214            {
 0215                throw new ArgumentNullException(nameof(vaultName));
 216            }
 0217            if (parameters == null)
 218            {
 0219                throw new ArgumentNullException(nameof(parameters));
 220            }
 221
 0222            using var message = CreateUpdateRequest(resourceGroupName, vaultName, parameters);
 0223            _pipeline.Send(message, cancellationToken);
 0224            switch (message.Response.Status)
 225            {
 226                case 200:
 227                case 201:
 228                    {
 229                        Vault value = default;
 0230                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0231                        value = Vault.DeserializeVault(document.RootElement);
 0232                        return Response.FromValue(value, message.Response);
 233                    }
 234                default:
 0235                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 236            }
 0237        }
 238
 239        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string vaultName)
 240        {
 48241            var message = _pipeline.CreateMessage();
 48242            var request = message.Request;
 48243            request.Method = RequestMethod.Delete;
 48244            var uri = new RawRequestUriBuilder();
 48245            uri.Reset(endpoint);
 48246            uri.AppendPath("/subscriptions/", false);
 48247            uri.AppendPath(subscriptionId, true);
 48248            uri.AppendPath("/resourceGroups/", false);
 48249            uri.AppendPath(resourceGroupName, true);
 48250            uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false);
 48251            uri.AppendPath(vaultName, true);
 48252            uri.AppendQuery("api-version", apiVersion, true);
 48253            request.Uri = uri;
 48254            return message;
 255        }
 256
 257        /// <summary> Deletes the specified Azure key vault. </summary>
 258        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 259        /// <param name="vaultName"> The name of the vault to delete. </param>
 260        /// <param name="cancellationToken"> The cancellation token to use. </param>
 261        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/
 262        public async Task<Response> DeleteAsync(string resourceGroupName, string vaultName, CancellationToken cancellati
 263        {
 24264            if (resourceGroupName == null)
 265            {
 0266                throw new ArgumentNullException(nameof(resourceGroupName));
 267            }
 24268            if (vaultName == null)
 269            {
 0270                throw new ArgumentNullException(nameof(vaultName));
 271            }
 272
 24273            using var message = CreateDeleteRequest(resourceGroupName, vaultName);
 24274            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 24275            switch (message.Response.Status)
 276            {
 277                case 200:
 24278                    return message.Response;
 279                default:
 0280                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 281            }
 24282        }
 283
 284        /// <summary> Deletes the specified Azure key vault. </summary>
 285        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 286        /// <param name="vaultName"> The name of the vault to delete. </param>
 287        /// <param name="cancellationToken"> The cancellation token to use. </param>
 288        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/
 289        public Response Delete(string resourceGroupName, string vaultName, CancellationToken cancellationToken = default
 290        {
 24291            if (resourceGroupName == null)
 292            {
 0293                throw new ArgumentNullException(nameof(resourceGroupName));
 294            }
 24295            if (vaultName == null)
 296            {
 0297                throw new ArgumentNullException(nameof(vaultName));
 298            }
 299
 24300            using var message = CreateDeleteRequest(resourceGroupName, vaultName);
 24301            _pipeline.Send(message, cancellationToken);
 24302            switch (message.Response.Status)
 303            {
 304                case 200:
 24305                    return message.Response;
 306                default:
 0307                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 308            }
 24309        }
 310
 311        internal HttpMessage CreateGetRequest(string resourceGroupName, string vaultName)
 312        {
 28313            var message = _pipeline.CreateMessage();
 28314            var request = message.Request;
 28315            request.Method = RequestMethod.Get;
 28316            var uri = new RawRequestUriBuilder();
 28317            uri.Reset(endpoint);
 28318            uri.AppendPath("/subscriptions/", false);
 28319            uri.AppendPath(subscriptionId, true);
 28320            uri.AppendPath("/resourceGroups/", false);
 28321            uri.AppendPath(resourceGroupName, true);
 28322            uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false);
 28323            uri.AppendPath(vaultName, true);
 28324            uri.AppendQuery("api-version", apiVersion, true);
 28325            request.Uri = uri;
 28326            return message;
 327        }
 328
 329        /// <summary> Gets the specified Azure key vault. </summary>
 330        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 331        /// <param name="vaultName"> The name of the vault. </param>
 332        /// <param name="cancellationToken"> The cancellation token to use. </param>
 333        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/
 334        public async Task<Response<Vault>> GetAsync(string resourceGroupName, string vaultName, CancellationToken cancel
 335        {
 14336            if (resourceGroupName == null)
 337            {
 0338                throw new ArgumentNullException(nameof(resourceGroupName));
 339            }
 14340            if (vaultName == null)
 341            {
 0342                throw new ArgumentNullException(nameof(vaultName));
 343            }
 344
 14345            using var message = CreateGetRequest(resourceGroupName, vaultName);
 14346            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 14347            switch (message.Response.Status)
 348            {
 349                case 200:
 350                    {
 351                        Vault value = default;
 8352                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 8353                        value = Vault.DeserializeVault(document.RootElement);
 8354                        return Response.FromValue(value, message.Response);
 355                    }
 356                default:
 6357                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 358            }
 8359        }
 360
 361        /// <summary> Gets the specified Azure key vault. </summary>
 362        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 363        /// <param name="vaultName"> The name of the vault. </param>
 364        /// <param name="cancellationToken"> The cancellation token to use. </param>
 365        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/
 366        public Response<Vault> Get(string resourceGroupName, string vaultName, CancellationToken cancellationToken = def
 367        {
 14368            if (resourceGroupName == null)
 369            {
 0370                throw new ArgumentNullException(nameof(resourceGroupName));
 371            }
 14372            if (vaultName == null)
 373            {
 0374                throw new ArgumentNullException(nameof(vaultName));
 375            }
 376
 14377            using var message = CreateGetRequest(resourceGroupName, vaultName);
 14378            _pipeline.Send(message, cancellationToken);
 14379            switch (message.Response.Status)
 380            {
 381                case 200:
 382                    {
 383                        Vault value = default;
 8384                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 8385                        value = Vault.DeserializeVault(document.RootElement);
 8386                        return Response.FromValue(value, message.Response);
 387                    }
 388                default:
 6389                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 390            }
 8391        }
 392
 393        internal HttpMessage CreateUpdateAccessPolicyRequest(string resourceGroupName, string vaultName, AccessPolicyUpd
 394        {
 0395            var message = _pipeline.CreateMessage();
 0396            var request = message.Request;
 0397            request.Method = RequestMethod.Put;
 0398            var uri = new RawRequestUriBuilder();
 0399            uri.Reset(endpoint);
 0400            uri.AppendPath("/subscriptions/", false);
 0401            uri.AppendPath(subscriptionId, true);
 0402            uri.AppendPath("/resourceGroups/", false);
 0403            uri.AppendPath(resourceGroupName, true);
 0404            uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false);
 0405            uri.AppendPath(vaultName, true);
 0406            uri.AppendPath("/accessPolicies/", false);
 0407            uri.AppendPath(operationKind.ToSerialString(), true);
 0408            uri.AppendQuery("api-version", apiVersion, true);
 0409            request.Uri = uri;
 0410            request.Headers.Add("Content-Type", "application/json");
 0411            var content = new Utf8JsonRequestContent();
 0412            content.JsonWriter.WriteObjectValue(parameters);
 0413            request.Content = content;
 0414            return message;
 415        }
 416
 417        /// <summary> Update access policies in a key vault in the specified subscription. </summary>
 418        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 419        /// <param name="vaultName"> Name of the vault. </param>
 420        /// <param name="operationKind"> Name of the operation. </param>
 421        /// <param name="parameters"> Access policy to merge into the vault. </param>
 422        /// <param name="cancellationToken"> The cancellation token to use. </param>
 423        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 424        public async Task<Response<VaultAccessPolicyParameters>> UpdateAccessPolicyAsync(string resourceGroupName, strin
 425        {
 0426            if (resourceGroupName == null)
 427            {
 0428                throw new ArgumentNullException(nameof(resourceGroupName));
 429            }
 0430            if (vaultName == null)
 431            {
 0432                throw new ArgumentNullException(nameof(vaultName));
 433            }
 0434            if (parameters == null)
 435            {
 0436                throw new ArgumentNullException(nameof(parameters));
 437            }
 438
 0439            using var message = CreateUpdateAccessPolicyRequest(resourceGroupName, vaultName, operationKind, parameters)
 0440            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0441            switch (message.Response.Status)
 442            {
 443                case 200:
 444                case 201:
 445                    {
 446                        VaultAccessPolicyParameters value = default;
 0447                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0448                        value = VaultAccessPolicyParameters.DeserializeVaultAccessPolicyParameters(document.RootElement)
 0449                        return Response.FromValue(value, message.Response);
 450                    }
 451                default:
 0452                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 453            }
 0454        }
 455
 456        /// <summary> Update access policies in a key vault in the specified subscription. </summary>
 457        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 458        /// <param name="vaultName"> Name of the vault. </param>
 459        /// <param name="operationKind"> Name of the operation. </param>
 460        /// <param name="parameters"> Access policy to merge into the vault. </param>
 461        /// <param name="cancellationToken"> The cancellation token to use. </param>
 462        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>,
 463        public Response<VaultAccessPolicyParameters> UpdateAccessPolicy(string resourceGroupName, string vaultName, Acce
 464        {
 0465            if (resourceGroupName == null)
 466            {
 0467                throw new ArgumentNullException(nameof(resourceGroupName));
 468            }
 0469            if (vaultName == null)
 470            {
 0471                throw new ArgumentNullException(nameof(vaultName));
 472            }
 0473            if (parameters == null)
 474            {
 0475                throw new ArgumentNullException(nameof(parameters));
 476            }
 477
 0478            using var message = CreateUpdateAccessPolicyRequest(resourceGroupName, vaultName, operationKind, parameters)
 0479            _pipeline.Send(message, cancellationToken);
 0480            switch (message.Response.Status)
 481            {
 482                case 200:
 483                case 201:
 484                    {
 485                        VaultAccessPolicyParameters value = default;
 0486                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0487                        value = VaultAccessPolicyParameters.DeserializeVaultAccessPolicyParameters(document.RootElement)
 0488                        return Response.FromValue(value, message.Response);
 489                    }
 490                default:
 0491                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 492            }
 0493        }
 494
 495        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, int? top)
 496        {
 4497            var message = _pipeline.CreateMessage();
 4498            var request = message.Request;
 4499            request.Method = RequestMethod.Get;
 4500            var uri = new RawRequestUriBuilder();
 4501            uri.Reset(endpoint);
 4502            uri.AppendPath("/subscriptions/", false);
 4503            uri.AppendPath(subscriptionId, true);
 4504            uri.AppendPath("/resourceGroups/", false);
 4505            uri.AppendPath(resourceGroupName, true);
 4506            uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false);
 4507            if (top != null)
 508            {
 4509                uri.AppendQuery("$top", top.Value, true);
 510            }
 4511            uri.AppendQuery("api-version", apiVersion, true);
 4512            request.Uri = uri;
 4513            return message;
 514        }
 515
 516        /// <summary> The List operation gets information about the vaults associated with the subscription and within t
 517        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 518        /// <param name="top"> Maximum number of results to return. </param>
 519        /// <param name="cancellationToken"> The cancellation token to use. </param>
 520        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception>
 521        public async Task<Response<VaultListResult>> ListByResourceGroupAsync(string resourceGroupName, int? top = null,
 522        {
 2523            if (resourceGroupName == null)
 524            {
 0525                throw new ArgumentNullException(nameof(resourceGroupName));
 526            }
 527
 2528            using var message = CreateListByResourceGroupRequest(resourceGroupName, top);
 2529            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2530            switch (message.Response.Status)
 531            {
 532                case 200:
 533                    {
 534                        VaultListResult value = default;
 2535                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2536                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 2537                        return Response.FromValue(value, message.Response);
 538                    }
 539                default:
 0540                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 541            }
 2542        }
 543
 544        /// <summary> The List operation gets information about the vaults associated with the subscription and within t
 545        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 546        /// <param name="top"> Maximum number of results to return. </param>
 547        /// <param name="cancellationToken"> The cancellation token to use. </param>
 548        /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception>
 549        public Response<VaultListResult> ListByResourceGroup(string resourceGroupName, int? top = null, CancellationToke
 550        {
 2551            if (resourceGroupName == null)
 552            {
 0553                throw new ArgumentNullException(nameof(resourceGroupName));
 554            }
 555
 2556            using var message = CreateListByResourceGroupRequest(resourceGroupName, top);
 2557            _pipeline.Send(message, cancellationToken);
 2558            switch (message.Response.Status)
 559            {
 560                case 200:
 561                    {
 562                        VaultListResult value = default;
 2563                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2564                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 2565                        return Response.FromValue(value, message.Response);
 566                    }
 567                default:
 0568                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 569            }
 2570        }
 571
 572        internal HttpMessage CreateListBySubscriptionRequest(int? top)
 573        {
 0574            var message = _pipeline.CreateMessage();
 0575            var request = message.Request;
 0576            request.Method = RequestMethod.Get;
 0577            var uri = new RawRequestUriBuilder();
 0578            uri.Reset(endpoint);
 0579            uri.AppendPath("/subscriptions/", false);
 0580            uri.AppendPath(subscriptionId, true);
 0581            uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false);
 0582            if (top != null)
 583            {
 0584                uri.AppendQuery("$top", top.Value, true);
 585            }
 0586            uri.AppendQuery("api-version", apiVersion, true);
 0587            request.Uri = uri;
 0588            return message;
 589        }
 590
 591        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 592        /// <param name="top"> Maximum number of results to return. </param>
 593        /// <param name="cancellationToken"> The cancellation token to use. </param>
 594        public async Task<Response<VaultListResult>> ListBySubscriptionAsync(int? top = null, CancellationToken cancella
 595        {
 0596            using var message = CreateListBySubscriptionRequest(top);
 0597            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0598            switch (message.Response.Status)
 599            {
 600                case 200:
 601                    {
 602                        VaultListResult value = default;
 0603                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0604                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 0605                        return Response.FromValue(value, message.Response);
 606                    }
 607                default:
 0608                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 609            }
 0610        }
 611
 612        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 613        /// <param name="top"> Maximum number of results to return. </param>
 614        /// <param name="cancellationToken"> The cancellation token to use. </param>
 615        public Response<VaultListResult> ListBySubscription(int? top = null, CancellationToken cancellationToken = defau
 616        {
 0617            using var message = CreateListBySubscriptionRequest(top);
 0618            _pipeline.Send(message, cancellationToken);
 0619            switch (message.Response.Status)
 620            {
 621                case 200:
 622                    {
 623                        VaultListResult value = default;
 0624                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0625                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 0626                        return Response.FromValue(value, message.Response);
 627                    }
 628                default:
 0629                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 630            }
 0631        }
 632
 633        internal HttpMessage CreateListDeletedRequest()
 634        {
 4635            var message = _pipeline.CreateMessage();
 4636            var request = message.Request;
 4637            request.Method = RequestMethod.Get;
 4638            var uri = new RawRequestUriBuilder();
 4639            uri.Reset(endpoint);
 4640            uri.AppendPath("/subscriptions/", false);
 4641            uri.AppendPath(subscriptionId, true);
 4642            uri.AppendPath("/providers/Microsoft.KeyVault/deletedVaults", false);
 4643            uri.AppendQuery("api-version", apiVersion, true);
 4644            request.Uri = uri;
 4645            return message;
 646        }
 647
 648        /// <summary> Gets information about the deleted vaults in a subscription. </summary>
 649        /// <param name="cancellationToken"> The cancellation token to use. </param>
 650        public async Task<Response<DeletedVaultListResult>> ListDeletedAsync(CancellationToken cancellationToken = defau
 651        {
 2652            using var message = CreateListDeletedRequest();
 2653            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2654            switch (message.Response.Status)
 655            {
 656                case 200:
 657                    {
 658                        DeletedVaultListResult value = default;
 2659                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2660                        value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement);
 2661                        return Response.FromValue(value, message.Response);
 662                    }
 663                default:
 0664                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 665            }
 2666        }
 667
 668        /// <summary> Gets information about the deleted vaults in a subscription. </summary>
 669        /// <param name="cancellationToken"> The cancellation token to use. </param>
 670        public Response<DeletedVaultListResult> ListDeleted(CancellationToken cancellationToken = default)
 671        {
 2672            using var message = CreateListDeletedRequest();
 2673            _pipeline.Send(message, cancellationToken);
 2674            switch (message.Response.Status)
 675            {
 676                case 200:
 677                    {
 678                        DeletedVaultListResult value = default;
 2679                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2680                        value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement);
 2681                        return Response.FromValue(value, message.Response);
 682                    }
 683                default:
 0684                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 685            }
 2686        }
 687
 688        internal HttpMessage CreateGetDeletedRequest(string vaultName, string location)
 689        {
 24690            var message = _pipeline.CreateMessage();
 24691            var request = message.Request;
 24692            request.Method = RequestMethod.Get;
 24693            var uri = new RawRequestUriBuilder();
 24694            uri.Reset(endpoint);
 24695            uri.AppendPath("/subscriptions/", false);
 24696            uri.AppendPath(subscriptionId, true);
 24697            uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false);
 24698            uri.AppendPath(location, true);
 24699            uri.AppendPath("/deletedVaults/", false);
 24700            uri.AppendPath(vaultName, true);
 24701            uri.AppendQuery("api-version", apiVersion, true);
 24702            request.Uri = uri;
 24703            return message;
 704        }
 705
 706        /// <summary> Gets the deleted Azure key vault. </summary>
 707        /// <param name="vaultName"> The name of the vault. </param>
 708        /// <param name="location"> The location of the deleted vault. </param>
 709        /// <param name="cancellationToken"> The cancellation token to use. </param>
 710        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null
 711        public async Task<Response<DeletedVault>> GetDeletedAsync(string vaultName, string location, CancellationToken c
 712        {
 12713            if (vaultName == null)
 714            {
 0715                throw new ArgumentNullException(nameof(vaultName));
 716            }
 12717            if (location == null)
 718            {
 0719                throw new ArgumentNullException(nameof(location));
 720            }
 721
 12722            using var message = CreateGetDeletedRequest(vaultName, location);
 12723            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 12724            switch (message.Response.Status)
 725            {
 726                case 200:
 727                    {
 728                        DeletedVault value = default;
 6729                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6730                        value = DeletedVault.DeserializeDeletedVault(document.RootElement);
 6731                        return Response.FromValue(value, message.Response);
 732                    }
 733                default:
 6734                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 735            }
 6736        }
 737
 738        /// <summary> Gets the deleted Azure key vault. </summary>
 739        /// <param name="vaultName"> The name of the vault. </param>
 740        /// <param name="location"> The location of the deleted vault. </param>
 741        /// <param name="cancellationToken"> The cancellation token to use. </param>
 742        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null
 743        public Response<DeletedVault> GetDeleted(string vaultName, string location, CancellationToken cancellationToken 
 744        {
 12745            if (vaultName == null)
 746            {
 0747                throw new ArgumentNullException(nameof(vaultName));
 748            }
 12749            if (location == null)
 750            {
 0751                throw new ArgumentNullException(nameof(location));
 752            }
 753
 12754            using var message = CreateGetDeletedRequest(vaultName, location);
 12755            _pipeline.Send(message, cancellationToken);
 12756            switch (message.Response.Status)
 757            {
 758                case 200:
 759                    {
 760                        DeletedVault value = default;
 6761                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6762                        value = DeletedVault.DeserializeDeletedVault(document.RootElement);
 6763                        return Response.FromValue(value, message.Response);
 764                    }
 765                default:
 6766                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 767            }
 6768        }
 769
 770        internal HttpMessage CreatePurgeDeletedRequest(string vaultName, string location)
 771        {
 24772            var message = _pipeline.CreateMessage();
 24773            var request = message.Request;
 24774            request.Method = RequestMethod.Post;
 24775            var uri = new RawRequestUriBuilder();
 24776            uri.Reset(endpoint);
 24777            uri.AppendPath("/subscriptions/", false);
 24778            uri.AppendPath(subscriptionId, true);
 24779            uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false);
 24780            uri.AppendPath(location, true);
 24781            uri.AppendPath("/deletedVaults/", false);
 24782            uri.AppendPath(vaultName, true);
 24783            uri.AppendPath("/purge", false);
 24784            uri.AppendQuery("api-version", apiVersion, true);
 24785            request.Uri = uri;
 24786            return message;
 787        }
 788
 789        /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary>
 790        /// <param name="vaultName"> The name of the soft-deleted vault. </param>
 791        /// <param name="location"> The location of the soft-deleted vault. </param>
 792        /// <param name="cancellationToken"> The cancellation token to use. </param>
 793        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null
 794        public async Task<Response> PurgeDeletedAsync(string vaultName, string location, CancellationToken cancellationT
 795        {
 6796            if (vaultName == null)
 797            {
 0798                throw new ArgumentNullException(nameof(vaultName));
 799            }
 6800            if (location == null)
 801            {
 0802                throw new ArgumentNullException(nameof(location));
 803            }
 804
 6805            using var message = CreatePurgeDeletedRequest(vaultName, location);
 6806            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6807            switch (message.Response.Status)
 808            {
 809                case 200:
 810                case 202:
 6811                    return message.Response;
 812                default:
 0813                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 814            }
 6815        }
 816
 817        /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary>
 818        /// <param name="vaultName"> The name of the soft-deleted vault. </param>
 819        /// <param name="location"> The location of the soft-deleted vault. </param>
 820        /// <param name="cancellationToken"> The cancellation token to use. </param>
 821        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null
 822        public Response PurgeDeleted(string vaultName, string location, CancellationToken cancellationToken = default)
 823        {
 6824            if (vaultName == null)
 825            {
 0826                throw new ArgumentNullException(nameof(vaultName));
 827            }
 6828            if (location == null)
 829            {
 0830                throw new ArgumentNullException(nameof(location));
 831            }
 832
 6833            using var message = CreatePurgeDeletedRequest(vaultName, location);
 6834            _pipeline.Send(message, cancellationToken);
 6835            switch (message.Response.Status)
 836            {
 837                case 200:
 838                case 202:
 6839                    return message.Response;
 840                default:
 0841                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 842            }
 6843        }
 844
 845        internal HttpMessage CreateListRequest(int? top)
 846        {
 0847            var message = _pipeline.CreateMessage();
 0848            var request = message.Request;
 0849            request.Method = RequestMethod.Get;
 0850            var uri = new RawRequestUriBuilder();
 0851            uri.Reset(endpoint);
 0852            uri.AppendPath("/subscriptions/", false);
 0853            uri.AppendPath(subscriptionId, true);
 0854            uri.AppendPath("/resources", false);
 0855            uri.AppendQuery("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'", true);
 0856            if (top != null)
 857            {
 0858                uri.AppendQuery("$top", top.Value, true);
 859            }
 0860            uri.AppendQuery("api-version", apiVersion, true);
 0861            request.Uri = uri;
 0862            return message;
 863        }
 864
 865        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 866        /// <param name="top"> Maximum number of results to return. </param>
 867        /// <param name="cancellationToken"> The cancellation token to use. </param>
 868        public async Task<Response<ResourceListResult>> ListAsync(int? top = null, CancellationToken cancellationToken =
 869        {
 0870            using var message = CreateListRequest(top);
 0871            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0872            switch (message.Response.Status)
 873            {
 874                case 200:
 875                    {
 876                        ResourceListResult value = default;
 0877                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0878                        value = ResourceListResult.DeserializeResourceListResult(document.RootElement);
 0879                        return Response.FromValue(value, message.Response);
 880                    }
 881                default:
 0882                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 883            }
 0884        }
 885
 886        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 887        /// <param name="top"> Maximum number of results to return. </param>
 888        /// <param name="cancellationToken"> The cancellation token to use. </param>
 889        public Response<ResourceListResult> List(int? top = null, CancellationToken cancellationToken = default)
 890        {
 0891            using var message = CreateListRequest(top);
 0892            _pipeline.Send(message, cancellationToken);
 0893            switch (message.Response.Status)
 894            {
 895                case 200:
 896                    {
 897                        ResourceListResult value = default;
 0898                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0899                        value = ResourceListResult.DeserializeResourceListResult(document.RootElement);
 0900                        return Response.FromValue(value, message.Response);
 901                    }
 902                default:
 0903                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 904            }
 0905        }
 906
 907        internal HttpMessage CreateCheckNameAvailabilityRequest(VaultCheckNameAvailabilityParameters vaultName)
 908        {
 0909            var message = _pipeline.CreateMessage();
 0910            var request = message.Request;
 0911            request.Method = RequestMethod.Post;
 0912            var uri = new RawRequestUriBuilder();
 0913            uri.Reset(endpoint);
 0914            uri.AppendPath("/subscriptions/", false);
 0915            uri.AppendPath(subscriptionId, true);
 0916            uri.AppendPath("/providers/Microsoft.KeyVault/checkNameAvailability", false);
 0917            uri.AppendQuery("api-version", apiVersion, true);
 0918            request.Uri = uri;
 0919            request.Headers.Add("Content-Type", "application/json");
 0920            var content = new Utf8JsonRequestContent();
 0921            content.JsonWriter.WriteObjectValue(vaultName);
 0922            request.Content = content;
 0923            return message;
 924        }
 925
 926        /// <summary> Checks that the vault name is valid and is not already in use. </summary>
 927        /// <param name="vaultName"> The name of the vault. </param>
 928        /// <param name="cancellationToken"> The cancellation token to use. </param>
 929        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> is null. </exception>
 930        public async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(VaultCheckNameAvailabilityPa
 931        {
 0932            if (vaultName == null)
 933            {
 0934                throw new ArgumentNullException(nameof(vaultName));
 935            }
 936
 0937            using var message = CreateCheckNameAvailabilityRequest(vaultName);
 0938            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0939            switch (message.Response.Status)
 940            {
 941                case 200:
 942                    {
 943                        CheckNameAvailabilityResult value = default;
 0944                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0945                        value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement)
 0946                        return Response.FromValue(value, message.Response);
 947                    }
 948                default:
 0949                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 950            }
 0951        }
 952
 953        /// <summary> Checks that the vault name is valid and is not already in use. </summary>
 954        /// <param name="vaultName"> The name of the vault. </param>
 955        /// <param name="cancellationToken"> The cancellation token to use. </param>
 956        /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> is null. </exception>
 957        public Response<CheckNameAvailabilityResult> CheckNameAvailability(VaultCheckNameAvailabilityParameters vaultNam
 958        {
 0959            if (vaultName == null)
 960            {
 0961                throw new ArgumentNullException(nameof(vaultName));
 962            }
 963
 0964            using var message = CreateCheckNameAvailabilityRequest(vaultName);
 0965            _pipeline.Send(message, cancellationToken);
 0966            switch (message.Response.Status)
 967            {
 968                case 200:
 969                    {
 970                        CheckNameAvailabilityResult value = default;
 0971                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0972                        value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement)
 0973                        return Response.FromValue(value, message.Response);
 974                    }
 975                default:
 0976                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 977            }
 0978        }
 979
 980        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, int? to
 981        {
 4982            var message = _pipeline.CreateMessage();
 4983            var request = message.Request;
 4984            request.Method = RequestMethod.Get;
 4985            var uri = new RawRequestUriBuilder();
 4986            uri.Reset(endpoint);
 4987            uri.AppendRawNextLink(nextLink, false);
 4988            request.Uri = uri;
 4989            return message;
 990        }
 991
 992        /// <summary> The List operation gets information about the vaults associated with the subscription and within t
 993        /// <param name="nextLink"> The URL to the next page of results. </param>
 994        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 995        /// <param name="top"> Maximum number of results to return. </param>
 996        /// <param name="cancellationToken"> The cancellation token to use. </param>
 997        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="resourceGroupName"/>
 998        public async Task<Response<VaultListResult>> ListByResourceGroupNextPageAsync(string nextLink, string resourceGr
 999        {
 21000            if (nextLink == null)
 1001            {
 01002                throw new ArgumentNullException(nameof(nextLink));
 1003            }
 21004            if (resourceGroupName == null)
 1005            {
 01006                throw new ArgumentNullException(nameof(resourceGroupName));
 1007            }
 1008
 21009            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, top);
 21010            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 21011            switch (message.Response.Status)
 1012            {
 1013                case 200:
 1014                    {
 1015                        VaultListResult value = default;
 21016                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 21017                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 21018                        return Response.FromValue(value, message.Response);
 1019                    }
 1020                default:
 01021                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1022            }
 21023        }
 1024
 1025        /// <summary> The List operation gets information about the vaults associated with the subscription and within t
 1026        /// <param name="nextLink"> The URL to the next page of results. </param>
 1027        /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param>
 1028        /// <param name="top"> Maximum number of results to return. </param>
 1029        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1030        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="resourceGroupName"/>
 1031        public Response<VaultListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, int? top
 1032        {
 21033            if (nextLink == null)
 1034            {
 01035                throw new ArgumentNullException(nameof(nextLink));
 1036            }
 21037            if (resourceGroupName == null)
 1038            {
 01039                throw new ArgumentNullException(nameof(resourceGroupName));
 1040            }
 1041
 21042            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, top);
 21043            _pipeline.Send(message, cancellationToken);
 21044            switch (message.Response.Status)
 1045            {
 1046                case 200:
 1047                    {
 1048                        VaultListResult value = default;
 21049                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 21050                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 21051                        return Response.FromValue(value, message.Response);
 1052                    }
 1053                default:
 01054                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1055            }
 21056        }
 1057
 1058        internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, int? top)
 1059        {
 01060            var message = _pipeline.CreateMessage();
 01061            var request = message.Request;
 01062            request.Method = RequestMethod.Get;
 01063            var uri = new RawRequestUriBuilder();
 01064            uri.Reset(endpoint);
 01065            uri.AppendRawNextLink(nextLink, false);
 01066            request.Uri = uri;
 01067            return message;
 1068        }
 1069
 1070        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 1071        /// <param name="nextLink"> The URL to the next page of results. </param>
 1072        /// <param name="top"> Maximum number of results to return. </param>
 1073        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1074        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 1075        public async Task<Response<VaultListResult>> ListBySubscriptionNextPageAsync(string nextLink, int? top = null, C
 1076        {
 01077            if (nextLink == null)
 1078            {
 01079                throw new ArgumentNullException(nameof(nextLink));
 1080            }
 1081
 01082            using var message = CreateListBySubscriptionNextPageRequest(nextLink, top);
 01083            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01084            switch (message.Response.Status)
 1085            {
 1086                case 200:
 1087                    {
 1088                        VaultListResult value = default;
 01089                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01090                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 01091                        return Response.FromValue(value, message.Response);
 1092                    }
 1093                default:
 01094                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1095            }
 01096        }
 1097
 1098        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 1099        /// <param name="nextLink"> The URL to the next page of results. </param>
 1100        /// <param name="top"> Maximum number of results to return. </param>
 1101        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1102        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 1103        public Response<VaultListResult> ListBySubscriptionNextPage(string nextLink, int? top = null, CancellationToken 
 1104        {
 01105            if (nextLink == null)
 1106            {
 01107                throw new ArgumentNullException(nameof(nextLink));
 1108            }
 1109
 01110            using var message = CreateListBySubscriptionNextPageRequest(nextLink, top);
 01111            _pipeline.Send(message, cancellationToken);
 01112            switch (message.Response.Status)
 1113            {
 1114                case 200:
 1115                    {
 1116                        VaultListResult value = default;
 01117                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01118                        value = VaultListResult.DeserializeVaultListResult(document.RootElement);
 01119                        return Response.FromValue(value, message.Response);
 1120                    }
 1121                default:
 01122                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1123            }
 01124        }
 1125
 1126        internal HttpMessage CreateListDeletedNextPageRequest(string nextLink)
 1127        {
 01128            var message = _pipeline.CreateMessage();
 01129            var request = message.Request;
 01130            request.Method = RequestMethod.Get;
 01131            var uri = new RawRequestUriBuilder();
 01132            uri.Reset(endpoint);
 01133            uri.AppendRawNextLink(nextLink, false);
 01134            request.Uri = uri;
 01135            return message;
 1136        }
 1137
 1138        /// <summary> Gets information about the deleted vaults in a subscription. </summary>
 1139        /// <param name="nextLink"> The URL to the next page of results. </param>
 1140        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1141        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 1142        public async Task<Response<DeletedVaultListResult>> ListDeletedNextPageAsync(string nextLink, CancellationToken 
 1143        {
 01144            if (nextLink == null)
 1145            {
 01146                throw new ArgumentNullException(nameof(nextLink));
 1147            }
 1148
 01149            using var message = CreateListDeletedNextPageRequest(nextLink);
 01150            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01151            switch (message.Response.Status)
 1152            {
 1153                case 200:
 1154                    {
 1155                        DeletedVaultListResult value = default;
 01156                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01157                        value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement);
 01158                        return Response.FromValue(value, message.Response);
 1159                    }
 1160                default:
 01161                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1162            }
 01163        }
 1164
 1165        /// <summary> Gets information about the deleted vaults in a subscription. </summary>
 1166        /// <param name="nextLink"> The URL to the next page of results. </param>
 1167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1168        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 1169        public Response<DeletedVaultListResult> ListDeletedNextPage(string nextLink, CancellationToken cancellationToken
 1170        {
 01171            if (nextLink == null)
 1172            {
 01173                throw new ArgumentNullException(nameof(nextLink));
 1174            }
 1175
 01176            using var message = CreateListDeletedNextPageRequest(nextLink);
 01177            _pipeline.Send(message, cancellationToken);
 01178            switch (message.Response.Status)
 1179            {
 1180                case 200:
 1181                    {
 1182                        DeletedVaultListResult value = default;
 01183                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01184                        value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement);
 01185                        return Response.FromValue(value, message.Response);
 1186                    }
 1187                default:
 01188                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1189            }
 01190        }
 1191
 1192        internal HttpMessage CreateListNextPageRequest(string nextLink, int? top)
 1193        {
 01194            var message = _pipeline.CreateMessage();
 01195            var request = message.Request;
 01196            request.Method = RequestMethod.Get;
 01197            var uri = new RawRequestUriBuilder();
 01198            uri.Reset(endpoint);
 01199            uri.AppendRawNextLink(nextLink, false);
 01200            request.Uri = uri;
 01201            return message;
 1202        }
 1203
 1204        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 1205        /// <param name="nextLink"> The URL to the next page of results. </param>
 1206        /// <param name="top"> Maximum number of results to return. </param>
 1207        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1208        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 1209        public async Task<Response<ResourceListResult>> ListNextPageAsync(string nextLink, int? top = null, Cancellation
 1210        {
 01211            if (nextLink == null)
 1212            {
 01213                throw new ArgumentNullException(nameof(nextLink));
 1214            }
 1215
 01216            using var message = CreateListNextPageRequest(nextLink, top);
 01217            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01218            switch (message.Response.Status)
 1219            {
 1220                case 200:
 1221                    {
 1222                        ResourceListResult value = default;
 01223                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01224                        value = ResourceListResult.DeserializeResourceListResult(document.RootElement);
 01225                        return Response.FromValue(value, message.Response);
 1226                    }
 1227                default:
 01228                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1229            }
 01230        }
 1231
 1232        /// <summary> The List operation gets information about the vaults associated with the subscription. </summary>
 1233        /// <param name="nextLink"> The URL to the next page of results. </param>
 1234        /// <param name="top"> Maximum number of results to return. </param>
 1235        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1236        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 1237        public Response<ResourceListResult> ListNextPage(string nextLink, int? top = null, CancellationToken cancellatio
 1238        {
 01239            if (nextLink == null)
 1240            {
 01241                throw new ArgumentNullException(nameof(nextLink));
 1242            }
 1243
 01244            using var message = CreateListNextPageRequest(nextLink, top);
 01245            _pipeline.Send(message, cancellationToken);
 01246            switch (message.Response.Status)
 1247            {
 1248                case 200:
 1249                    {
 1250                        ResourceListResult value = default;
 01251                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01252                        value = ResourceListResult.DeserializeResourceListResult(document.RootElement);
 01253                        return Response.FromValue(value, message.Response);
 1254                    }
 1255                default:
 01256                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1257            }
 01258        }
 1259    }
 1260}