< Summary

Class:Azure.ResourceManager.Compute.DiskEncryptionSetsRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\DiskEncryptionSetsRestOperations.cs
Covered lines:204
Uncovered lines:111
Coverable lines:315
Total lines:704
Line coverage:64.7% (204 of 315)
Covered branches:52
Total branches:124
Branch coverage:41.9% (52 of 124)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-66.67%50%
CreateOrUpdate(...)-66.67%50%
CreateUpdateRequest(...)-100%100%
UpdateAsync()-66.67%60%
Update(...)-66.67%60%
CreateGetRequest(...)-100%100%
GetAsync()-80%62.5%
Get(...)-80%62.5%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateListByResourceGroupRequest(...)-100%100%
ListByResourceGroupAsync()-76.92%50%
ListByResourceGroup(...)-76.92%50%
CreateListRequest()-100%100%
ListAsync()-81.82%50%
List(...)-81.82%50%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\DiskEncryptionSetsRestOperations.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.Compute.Models;
 16
 17namespace Azure.ResourceManager.Compute
 18{
 19    internal partial class DiskEncryptionSetsRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of DiskEncryptionSetsRestOperations. </summary>
 27        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 28        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 29        /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 39632        public DiskEncryptionSetsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc
 33        {
 39634            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 39638            endpoint ??= new Uri("https://management.azure.com");
 39
 39640            this.subscriptionId = subscriptionId;
 39641            this.endpoint = endpoint;
 39642            _clientDiagnostics = clientDiagnostics;
 39643            _pipeline = pipeline;
 39644        }
 45
 46        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string diskEncryptionSetName, DiskEnc
 47        {
 4048            var message = _pipeline.CreateMessage();
 4049            var request = message.Request;
 4050            request.Method = RequestMethod.Put;
 4051            var uri = new RawRequestUriBuilder();
 4052            uri.Reset(endpoint);
 4053            uri.AppendPath("/subscriptions/", false);
 4054            uri.AppendPath(subscriptionId, true);
 4055            uri.AppendPath("/resourceGroups/", false);
 4056            uri.AppendPath(resourceGroupName, true);
 4057            uri.AppendPath("/providers/Microsoft.Compute/diskEncryptionSets/", false);
 4058            uri.AppendPath(diskEncryptionSetName, true);
 4059            uri.AppendQuery("api-version", "2019-11-01", true);
 4060            request.Uri = uri;
 4061            request.Headers.Add("Content-Type", "application/json");
 4062            var content = new Utf8JsonRequestContent();
 4063            content.JsonWriter.WriteObjectValue(diskEncryptionSet);
 4064            request.Content = content;
 4065            return message;
 66        }
 67
 68        /// <summary> Creates or updates a disk encryption set. </summary>
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 71        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Put disk encryption 
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncr
 74        {
 1075            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 1079            if (diskEncryptionSetName == null)
 80            {
 081                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 82            }
 1083            if (diskEncryptionSet == null)
 84            {
 085                throw new ArgumentNullException(nameof(diskEncryptionSet));
 86            }
 87
 1088            using var message = CreateCreateOrUpdateRequest(resourceGroupName, diskEncryptionSetName, diskEncryptionSet)
 1089            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 1090            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 1094                    return message.Response;
 95                default:
 096                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 97            }
 1098        }
 99
 100        /// <summary> Creates or updates a disk encryption set. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 103        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Put disk encryption 
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public Response CreateOrUpdate(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEnc
 106        {
 10107            if (resourceGroupName == null)
 108            {
 0109                throw new ArgumentNullException(nameof(resourceGroupName));
 110            }
 10111            if (diskEncryptionSetName == null)
 112            {
 0113                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 114            }
 10115            if (diskEncryptionSet == null)
 116            {
 0117                throw new ArgumentNullException(nameof(diskEncryptionSet));
 118            }
 119
 10120            using var message = CreateCreateOrUpdateRequest(resourceGroupName, diskEncryptionSetName, diskEncryptionSet)
 10121            _pipeline.Send(message, cancellationToken);
 10122            switch (message.Response.Status)
 123            {
 124                case 200:
 125                case 201:
 10126                    return message.Response;
 127                default:
 0128                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 129            }
 10130        }
 131
 132        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionS
 133        {
 8134            var message = _pipeline.CreateMessage();
 8135            var request = message.Request;
 8136            request.Method = RequestMethod.Patch;
 8137            var uri = new RawRequestUriBuilder();
 8138            uri.Reset(endpoint);
 8139            uri.AppendPath("/subscriptions/", false);
 8140            uri.AppendPath(subscriptionId, true);
 8141            uri.AppendPath("/resourceGroups/", false);
 8142            uri.AppendPath(resourceGroupName, true);
 8143            uri.AppendPath("/providers/Microsoft.Compute/diskEncryptionSets/", false);
 8144            uri.AppendPath(diskEncryptionSetName, true);
 8145            uri.AppendQuery("api-version", "2019-11-01", true);
 8146            request.Uri = uri;
 8147            request.Headers.Add("Content-Type", "application/json");
 8148            var content = new Utf8JsonRequestContent();
 8149            content.JsonWriter.WriteObjectValue(diskEncryptionSet);
 8150            request.Content = content;
 8151            return message;
 152        }
 153
 154        /// <summary> Updates (patches) a disk encryption set. </summary>
 155        /// <param name="resourceGroupName"> The name of the resource group. </param>
 156        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 157        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Patch disk encryptio
 158        /// <param name="cancellationToken"> The cancellation token to use. </param>
 159        public async Task<Response> UpdateAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSe
 160        {
 2161            if (resourceGroupName == null)
 162            {
 0163                throw new ArgumentNullException(nameof(resourceGroupName));
 164            }
 2165            if (diskEncryptionSetName == null)
 166            {
 0167                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 168            }
 2169            if (diskEncryptionSet == null)
 170            {
 0171                throw new ArgumentNullException(nameof(diskEncryptionSet));
 172            }
 173
 2174            using var message = CreateUpdateRequest(resourceGroupName, diskEncryptionSetName, diskEncryptionSet);
 2175            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2176            switch (message.Response.Status)
 177            {
 178                case 200:
 179                case 202:
 2180                    return message.Response;
 181                default:
 0182                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 183            }
 2184        }
 185
 186        /// <summary> Updates (patches) a disk encryption set. </summary>
 187        /// <param name="resourceGroupName"> The name of the resource group. </param>
 188        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 189        /// <param name="diskEncryptionSet"> disk encryption set object supplied in the body of the Patch disk encryptio
 190        /// <param name="cancellationToken"> The cancellation token to use. </param>
 191        public Response Update(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncry
 192        {
 2193            if (resourceGroupName == null)
 194            {
 0195                throw new ArgumentNullException(nameof(resourceGroupName));
 196            }
 2197            if (diskEncryptionSetName == null)
 198            {
 0199                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 200            }
 2201            if (diskEncryptionSet == null)
 202            {
 0203                throw new ArgumentNullException(nameof(diskEncryptionSet));
 204            }
 205
 2206            using var message = CreateUpdateRequest(resourceGroupName, diskEncryptionSetName, diskEncryptionSet);
 2207            _pipeline.Send(message, cancellationToken);
 2208            switch (message.Response.Status)
 209            {
 210                case 200:
 211                case 202:
 2212                    return message.Response;
 213                default:
 0214                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 215            }
 2216        }
 217
 218        internal HttpMessage CreateGetRequest(string resourceGroupName, string diskEncryptionSetName)
 219        {
 8220            var message = _pipeline.CreateMessage();
 8221            var request = message.Request;
 8222            request.Method = RequestMethod.Get;
 8223            var uri = new RawRequestUriBuilder();
 8224            uri.Reset(endpoint);
 8225            uri.AppendPath("/subscriptions/", false);
 8226            uri.AppendPath(subscriptionId, true);
 8227            uri.AppendPath("/resourceGroups/", false);
 8228            uri.AppendPath(resourceGroupName, true);
 8229            uri.AppendPath("/providers/Microsoft.Compute/diskEncryptionSets/", false);
 8230            uri.AppendPath(diskEncryptionSetName, true);
 8231            uri.AppendQuery("api-version", "2019-11-01", true);
 8232            request.Uri = uri;
 8233            return message;
 234        }
 235
 236        /// <summary> Gets information about a disk encryption set. </summary>
 237        /// <param name="resourceGroupName"> The name of the resource group. </param>
 238        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 240        public async Task<Response<DiskEncryptionSet>> GetAsync(string resourceGroupName, string diskEncryptionSetName, 
 241        {
 4242            if (resourceGroupName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(resourceGroupName));
 245            }
 4246            if (diskEncryptionSetName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 249            }
 250
 4251            using var message = CreateGetRequest(resourceGroupName, diskEncryptionSetName);
 4252            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4253            switch (message.Response.Status)
 254            {
 255                case 200:
 256                    {
 2257                        DiskEncryptionSet value = default;
 2258                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2259                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 260                        {
 0261                            value = null;
 262                        }
 263                        else
 264                        {
 2265                            value = DiskEncryptionSet.DeserializeDiskEncryptionSet(document.RootElement);
 266                        }
 2267                        return Response.FromValue(value, message.Response);
 268                    }
 269                default:
 2270                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 271            }
 2272        }
 273
 274        /// <summary> Gets information about a disk encryption set. </summary>
 275        /// <param name="resourceGroupName"> The name of the resource group. </param>
 276        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 277        /// <param name="cancellationToken"> The cancellation token to use. </param>
 278        public Response<DiskEncryptionSet> Get(string resourceGroupName, string diskEncryptionSetName, CancellationToken
 279        {
 4280            if (resourceGroupName == null)
 281            {
 0282                throw new ArgumentNullException(nameof(resourceGroupName));
 283            }
 4284            if (diskEncryptionSetName == null)
 285            {
 0286                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 287            }
 288
 4289            using var message = CreateGetRequest(resourceGroupName, diskEncryptionSetName);
 4290            _pipeline.Send(message, cancellationToken);
 4291            switch (message.Response.Status)
 292            {
 293                case 200:
 294                    {
 2295                        DiskEncryptionSet value = default;
 2296                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2297                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 298                        {
 0299                            value = null;
 300                        }
 301                        else
 302                        {
 2303                            value = DiskEncryptionSet.DeserializeDiskEncryptionSet(document.RootElement);
 304                        }
 2305                        return Response.FromValue(value, message.Response);
 306                    }
 307                default:
 2308                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 309            }
 2310        }
 311
 312        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string diskEncryptionSetName)
 313        {
 40314            var message = _pipeline.CreateMessage();
 40315            var request = message.Request;
 40316            request.Method = RequestMethod.Delete;
 40317            var uri = new RawRequestUriBuilder();
 40318            uri.Reset(endpoint);
 40319            uri.AppendPath("/subscriptions/", false);
 40320            uri.AppendPath(subscriptionId, true);
 40321            uri.AppendPath("/resourceGroups/", false);
 40322            uri.AppendPath(resourceGroupName, true);
 40323            uri.AppendPath("/providers/Microsoft.Compute/diskEncryptionSets/", false);
 40324            uri.AppendPath(diskEncryptionSetName, true);
 40325            uri.AppendQuery("api-version", "2019-11-01", true);
 40326            request.Uri = uri;
 40327            return message;
 328        }
 329
 330        /// <summary> Deletes a disk encryption set. </summary>
 331        /// <param name="resourceGroupName"> The name of the resource group. </param>
 332        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 333        /// <param name="cancellationToken"> The cancellation token to use. </param>
 334        public async Task<Response> DeleteAsync(string resourceGroupName, string diskEncryptionSetName, CancellationToke
 335        {
 10336            if (resourceGroupName == null)
 337            {
 0338                throw new ArgumentNullException(nameof(resourceGroupName));
 339            }
 10340            if (diskEncryptionSetName == null)
 341            {
 0342                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 343            }
 344
 10345            using var message = CreateDeleteRequest(resourceGroupName, diskEncryptionSetName);
 10346            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 10347            switch (message.Response.Status)
 348            {
 349                case 200:
 350                case 202:
 351                case 204:
 10352                    return message.Response;
 353                default:
 0354                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 355            }
 10356        }
 357
 358        /// <summary> Deletes a disk encryption set. </summary>
 359        /// <param name="resourceGroupName"> The name of the resource group. </param>
 360        /// <param name="diskEncryptionSetName"> The name of the disk encryption set that is being created. The name can
 361        /// <param name="cancellationToken"> The cancellation token to use. </param>
 362        public Response Delete(string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationTok
 363        {
 10364            if (resourceGroupName == null)
 365            {
 0366                throw new ArgumentNullException(nameof(resourceGroupName));
 367            }
 10368            if (diskEncryptionSetName == null)
 369            {
 0370                throw new ArgumentNullException(nameof(diskEncryptionSetName));
 371            }
 372
 10373            using var message = CreateDeleteRequest(resourceGroupName, diskEncryptionSetName);
 10374            _pipeline.Send(message, cancellationToken);
 10375            switch (message.Response.Status)
 376            {
 377                case 200:
 378                case 202:
 379                case 204:
 10380                    return message.Response;
 381                default:
 0382                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 383            }
 10384        }
 385
 386        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 387        {
 8388            var message = _pipeline.CreateMessage();
 8389            var request = message.Request;
 8390            request.Method = RequestMethod.Get;
 8391            var uri = new RawRequestUriBuilder();
 8392            uri.Reset(endpoint);
 8393            uri.AppendPath("/subscriptions/", false);
 8394            uri.AppendPath(subscriptionId, true);
 8395            uri.AppendPath("/resourceGroups/", false);
 8396            uri.AppendPath(resourceGroupName, true);
 8397            uri.AppendPath("/providers/Microsoft.Compute/diskEncryptionSets", false);
 8398            uri.AppendQuery("api-version", "2019-11-01", true);
 8399            request.Uri = uri;
 8400            return message;
 401        }
 402
 403        /// <summary> Lists all the disk encryption sets under a resource group. </summary>
 404        /// <param name="resourceGroupName"> The name of the resource group. </param>
 405        /// <param name="cancellationToken"> The cancellation token to use. </param>
 406        public async Task<Response<DiskEncryptionSetList>> ListByResourceGroupAsync(string resourceGroupName, Cancellati
 407        {
 4408            if (resourceGroupName == null)
 409            {
 0410                throw new ArgumentNullException(nameof(resourceGroupName));
 411            }
 412
 4413            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 4414            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4415            switch (message.Response.Status)
 416            {
 417                case 200:
 418                    {
 4419                        DiskEncryptionSetList value = default;
 4420                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4421                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 422                        {
 0423                            value = null;
 424                        }
 425                        else
 426                        {
 4427                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 428                        }
 4429                        return Response.FromValue(value, message.Response);
 430                    }
 431                default:
 0432                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 433            }
 4434        }
 435
 436        /// <summary> Lists all the disk encryption sets under a resource group. </summary>
 437        /// <param name="resourceGroupName"> The name of the resource group. </param>
 438        /// <param name="cancellationToken"> The cancellation token to use. </param>
 439        public Response<DiskEncryptionSetList> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat
 440        {
 4441            if (resourceGroupName == null)
 442            {
 0443                throw new ArgumentNullException(nameof(resourceGroupName));
 444            }
 445
 4446            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 4447            _pipeline.Send(message, cancellationToken);
 4448            switch (message.Response.Status)
 449            {
 450                case 200:
 451                    {
 4452                        DiskEncryptionSetList value = default;
 4453                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4454                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 455                        {
 0456                            value = null;
 457                        }
 458                        else
 459                        {
 4460                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 461                        }
 4462                        return Response.FromValue(value, message.Response);
 463                    }
 464                default:
 0465                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 466            }
 4467        }
 468
 469        internal HttpMessage CreateListRequest()
 470        {
 4471            var message = _pipeline.CreateMessage();
 4472            var request = message.Request;
 4473            request.Method = RequestMethod.Get;
 4474            var uri = new RawRequestUriBuilder();
 4475            uri.Reset(endpoint);
 4476            uri.AppendPath("/subscriptions/", false);
 4477            uri.AppendPath(subscriptionId, true);
 4478            uri.AppendPath("/providers/Microsoft.Compute/diskEncryptionSets", false);
 4479            uri.AppendQuery("api-version", "2019-11-01", true);
 4480            request.Uri = uri;
 4481            return message;
 482        }
 483
 484        /// <summary> Lists all the disk encryption sets under a subscription. </summary>
 485        /// <param name="cancellationToken"> The cancellation token to use. </param>
 486        public async Task<Response<DiskEncryptionSetList>> ListAsync(CancellationToken cancellationToken = default)
 487        {
 2488            using var message = CreateListRequest();
 2489            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2490            switch (message.Response.Status)
 491            {
 492                case 200:
 493                    {
 2494                        DiskEncryptionSetList value = default;
 2495                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2496                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 497                        {
 0498                            value = null;
 499                        }
 500                        else
 501                        {
 2502                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 503                        }
 2504                        return Response.FromValue(value, message.Response);
 505                    }
 506                default:
 0507                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 508            }
 2509        }
 510
 511        /// <summary> Lists all the disk encryption sets under a subscription. </summary>
 512        /// <param name="cancellationToken"> The cancellation token to use. </param>
 513        public Response<DiskEncryptionSetList> List(CancellationToken cancellationToken = default)
 514        {
 2515            using var message = CreateListRequest();
 2516            _pipeline.Send(message, cancellationToken);
 2517            switch (message.Response.Status)
 518            {
 519                case 200:
 520                    {
 2521                        DiskEncryptionSetList value = default;
 2522                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2523                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 524                        {
 0525                            value = null;
 526                        }
 527                        else
 528                        {
 2529                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 530                        }
 2531                        return Response.FromValue(value, message.Response);
 532                    }
 533                default:
 0534                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 535            }
 2536        }
 537
 538        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 539        {
 0540            var message = _pipeline.CreateMessage();
 0541            var request = message.Request;
 0542            request.Method = RequestMethod.Get;
 0543            var uri = new RawRequestUriBuilder();
 0544            uri.Reset(endpoint);
 0545            uri.AppendRawNextLink(nextLink, false);
 0546            request.Uri = uri;
 0547            return message;
 548        }
 549
 550        /// <summary> Lists all the disk encryption sets under a resource group. </summary>
 551        /// <param name="nextLink"> The URL to the next page of results. </param>
 552        /// <param name="resourceGroupName"> The name of the resource group. </param>
 553        /// <param name="cancellationToken"> The cancellation token to use. </param>
 554        public async Task<Response<DiskEncryptionSetList>> ListByResourceGroupNextPageAsync(string nextLink, string reso
 555        {
 0556            if (nextLink == null)
 557            {
 0558                throw new ArgumentNullException(nameof(nextLink));
 559            }
 0560            if (resourceGroupName == null)
 561            {
 0562                throw new ArgumentNullException(nameof(resourceGroupName));
 563            }
 564
 0565            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0566            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0567            switch (message.Response.Status)
 568            {
 569                case 200:
 570                    {
 0571                        DiskEncryptionSetList value = default;
 0572                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0573                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 574                        {
 0575                            value = null;
 576                        }
 577                        else
 578                        {
 0579                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 580                        }
 0581                        return Response.FromValue(value, message.Response);
 582                    }
 583                default:
 0584                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 585            }
 0586        }
 587
 588        /// <summary> Lists all the disk encryption sets under a resource group. </summary>
 589        /// <param name="nextLink"> The URL to the next page of results. </param>
 590        /// <param name="resourceGroupName"> The name of the resource group. </param>
 591        /// <param name="cancellationToken"> The cancellation token to use. </param>
 592        public Response<DiskEncryptionSetList> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Ca
 593        {
 0594            if (nextLink == null)
 595            {
 0596                throw new ArgumentNullException(nameof(nextLink));
 597            }
 0598            if (resourceGroupName == null)
 599            {
 0600                throw new ArgumentNullException(nameof(resourceGroupName));
 601            }
 602
 0603            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0604            _pipeline.Send(message, cancellationToken);
 0605            switch (message.Response.Status)
 606            {
 607                case 200:
 608                    {
 0609                        DiskEncryptionSetList value = default;
 0610                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0611                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 612                        {
 0613                            value = null;
 614                        }
 615                        else
 616                        {
 0617                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 618                        }
 0619                        return Response.FromValue(value, message.Response);
 620                    }
 621                default:
 0622                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 623            }
 0624        }
 625
 626        internal HttpMessage CreateListNextPageRequest(string nextLink)
 627        {
 0628            var message = _pipeline.CreateMessage();
 0629            var request = message.Request;
 0630            request.Method = RequestMethod.Get;
 0631            var uri = new RawRequestUriBuilder();
 0632            uri.Reset(endpoint);
 0633            uri.AppendRawNextLink(nextLink, false);
 0634            request.Uri = uri;
 0635            return message;
 636        }
 637
 638        /// <summary> Lists all the disk encryption sets under a subscription. </summary>
 639        /// <param name="nextLink"> The URL to the next page of results. </param>
 640        /// <param name="cancellationToken"> The cancellation token to use. </param>
 641        public async Task<Response<DiskEncryptionSetList>> ListNextPageAsync(string nextLink, CancellationToken cancella
 642        {
 0643            if (nextLink == null)
 644            {
 0645                throw new ArgumentNullException(nameof(nextLink));
 646            }
 647
 0648            using var message = CreateListNextPageRequest(nextLink);
 0649            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0650            switch (message.Response.Status)
 651            {
 652                case 200:
 653                    {
 0654                        DiskEncryptionSetList value = default;
 0655                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0656                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 657                        {
 0658                            value = null;
 659                        }
 660                        else
 661                        {
 0662                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 663                        }
 0664                        return Response.FromValue(value, message.Response);
 665                    }
 666                default:
 0667                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 668            }
 0669        }
 670
 671        /// <summary> Lists all the disk encryption sets under a subscription. </summary>
 672        /// <param name="nextLink"> The URL to the next page of results. </param>
 673        /// <param name="cancellationToken"> The cancellation token to use. </param>
 674        public Response<DiskEncryptionSetList> ListNextPage(string nextLink, CancellationToken cancellationToken = defau
 675        {
 0676            if (nextLink == null)
 677            {
 0678                throw new ArgumentNullException(nameof(nextLink));
 679            }
 680
 0681            using var message = CreateListNextPageRequest(nextLink);
 0682            _pipeline.Send(message, cancellationToken);
 0683            switch (message.Response.Status)
 684            {
 685                case 200:
 686                    {
 0687                        DiskEncryptionSetList value = default;
 0688                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0689                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 690                        {
 0691                            value = null;
 692                        }
 693                        else
 694                        {
 0695                            value = DiskEncryptionSetList.DeserializeDiskEncryptionSetList(document.RootElement);
 696                        }
 0697                        return Response.FromValue(value, message.Response);
 698                    }
 699                default:
 0700                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 701            }
 0702        }
 703    }
 704}