< Summary

Class:Azure.ResourceManager.Resources.ProvidersRestOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ProvidersRestOperations.cs
Covered lines:146
Uncovered lines:159
Coverable lines:305
Total lines:710
Line coverage:47.8% (146 of 305)
Covered branches:35
Total branches:104
Branch coverage:33.6% (35 of 104)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateUnregisterRequest(...)-100%100%
UnregisterAsync()-84.62%66.67%
Unregister(...)-84.62%66.67%
CreateRegisterRequest(...)-100%100%
RegisterAsync()-84.62%66.67%
Register(...)-84.62%66.67%
CreateListRequest(...)-93.33%75%
ListAsync()-81.82%50%
List(...)-81.82%50%
CreateListAtTenantScopeRequest(...)-0%0%
ListAtTenantScopeAsync()-0%0%
ListAtTenantScope(...)-0%0%
CreateGetRequest(...)-100%100%
GetAsync()-84.62%66.67%
Get(...)-84.62%66.67%
CreateGetAtTenantScopeRequest(...)-0%0%
GetAtTenantScopeAsync()-0%0%
GetAtTenantScope(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%
CreateListAtTenantScopeNextPageRequest(...)-0%100%
ListAtTenantScopeNextPageAsync()-0%0%
ListAtTenantScopeNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ProvidersRestOperations.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.Resources.Models;
 16
 17namespace Azure.ResourceManager.Resources
 18{
 19    internal partial class ProvidersRestOperations
 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 ProvidersRestOperations. </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"> The ID of the target subscription. </param>
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 28432        public ProvidersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId
 33        {
 28434            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 28438            endpoint ??= new Uri("https://management.azure.com");
 39
 28440            this.subscriptionId = subscriptionId;
 28441            this.endpoint = endpoint;
 28442            _clientDiagnostics = clientDiagnostics;
 28443            _pipeline = pipeline;
 28444        }
 45
 46        internal Core.HttpMessage CreateUnregisterRequest(string resourceProviderNamespace)
 47        {
 848            var message = _pipeline.CreateMessage();
 849            var request = message.Request;
 850            request.Method = RequestMethod.Post;
 851            var uri = new RawRequestUriBuilder();
 852            uri.Reset(endpoint);
 853            uri.AppendPath("/subscriptions/", false);
 854            uri.AppendPath(subscriptionId, true);
 855            uri.AppendPath("/providers/", false);
 856            uri.AppendPath(resourceProviderNamespace, true);
 857            uri.AppendPath("/unregister", false);
 858            uri.AppendQuery("api-version", "2019-10-01", true);
 859            request.Uri = uri;
 860            return message;
 61        }
 62
 63        /// <summary> Unregisters a subscription from a resource provider. </summary>
 64        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param>
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public async Task<Response<Provider>> UnregisterAsync(string resourceProviderNamespace, CancellationToken cancel
 67        {
 668            if (resourceProviderNamespace == null)
 69            {
 270                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 71            }
 72
 473            using var message = CreateUnregisterRequest(resourceProviderNamespace);
 474            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 475            switch (message.Response.Status)
 76            {
 77                case 200:
 78                    {
 479                        Provider value = default;
 480                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 481                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 82                        {
 083                            value = null;
 84                        }
 85                        else
 86                        {
 487                            value = Provider.DeserializeProvider(document.RootElement);
 88                        }
 489                        return Response.FromValue(value, message.Response);
 90                    }
 91                default:
 092                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 93            }
 494        }
 95
 96        /// <summary> Unregisters a subscription from a resource provider. </summary>
 97        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param>
 98        /// <param name="cancellationToken"> The cancellation token to use. </param>
 99        public Response<Provider> Unregister(string resourceProviderNamespace, CancellationToken cancellationToken = def
 100        {
 6101            if (resourceProviderNamespace == null)
 102            {
 2103                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 104            }
 105
 4106            using var message = CreateUnregisterRequest(resourceProviderNamespace);
 4107            _pipeline.Send(message, cancellationToken);
 4108            switch (message.Response.Status)
 109            {
 110                case 200:
 111                    {
 4112                        Provider value = default;
 4113                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4114                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 115                        {
 0116                            value = null;
 117                        }
 118                        else
 119                        {
 4120                            value = Provider.DeserializeProvider(document.RootElement);
 121                        }
 4122                        return Response.FromValue(value, message.Response);
 123                    }
 124                default:
 0125                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 126            }
 4127        }
 128
 129        internal Core.HttpMessage CreateRegisterRequest(string resourceProviderNamespace)
 130        {
 24131            var message = _pipeline.CreateMessage();
 24132            var request = message.Request;
 24133            request.Method = RequestMethod.Post;
 24134            var uri = new RawRequestUriBuilder();
 24135            uri.Reset(endpoint);
 24136            uri.AppendPath("/subscriptions/", false);
 24137            uri.AppendPath(subscriptionId, true);
 24138            uri.AppendPath("/providers/", false);
 24139            uri.AppendPath(resourceProviderNamespace, true);
 24140            uri.AppendPath("/register", false);
 24141            uri.AppendQuery("api-version", "2019-10-01", true);
 24142            request.Uri = uri;
 24143            return message;
 144        }
 145
 146        /// <summary> Registers a subscription with a resource provider. </summary>
 147        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param>
 148        /// <param name="cancellationToken"> The cancellation token to use. </param>
 149        public async Task<Response<Provider>> RegisterAsync(string resourceProviderNamespace, CancellationToken cancella
 150        {
 14151            if (resourceProviderNamespace == null)
 152            {
 2153                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 154            }
 155
 12156            using var message = CreateRegisterRequest(resourceProviderNamespace);
 12157            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 12158            switch (message.Response.Status)
 159            {
 160                case 200:
 161                    {
 12162                        Provider value = default;
 12163                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 12164                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 165                        {
 0166                            value = null;
 167                        }
 168                        else
 169                        {
 12170                            value = Provider.DeserializeProvider(document.RootElement);
 171                        }
 12172                        return Response.FromValue(value, message.Response);
 173                    }
 174                default:
 0175                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 176            }
 12177        }
 178
 179        /// <summary> Registers a subscription with a resource provider. </summary>
 180        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param>
 181        /// <param name="cancellationToken"> The cancellation token to use. </param>
 182        public Response<Provider> Register(string resourceProviderNamespace, CancellationToken cancellationToken = defau
 183        {
 14184            if (resourceProviderNamespace == null)
 185            {
 2186                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 187            }
 188
 12189            using var message = CreateRegisterRequest(resourceProviderNamespace);
 12190            _pipeline.Send(message, cancellationToken);
 12191            switch (message.Response.Status)
 192            {
 193                case 200:
 194                    {
 12195                        Provider value = default;
 12196                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 12197                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 198                        {
 0199                            value = null;
 200                        }
 201                        else
 202                        {
 12203                            value = Provider.DeserializeProvider(document.RootElement);
 204                        }
 12205                        return Response.FromValue(value, message.Response);
 206                    }
 207                default:
 0208                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 209            }
 12210        }
 211
 212        internal Core.HttpMessage CreateListRequest(int? top, string expand)
 213        {
 12214            var message = _pipeline.CreateMessage();
 12215            var request = message.Request;
 12216            request.Method = RequestMethod.Get;
 12217            var uri = new RawRequestUriBuilder();
 12218            uri.Reset(endpoint);
 12219            uri.AppendPath("/subscriptions/", false);
 12220            uri.AppendPath(subscriptionId, true);
 12221            uri.AppendPath("/providers", false);
 12222            if (top != null)
 223            {
 0224                uri.AppendQuery("$top", top.Value, true);
 225            }
 12226            if (expand != null)
 227            {
 4228                uri.AppendQuery("$expand", expand, true);
 229            }
 12230            uri.AppendQuery("api-version", "2019-10-01", true);
 12231            request.Uri = uri;
 12232            return message;
 233        }
 234
 235        /// <summary> Gets all resource providers for a subscription. </summary>
 236        /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param>
 237        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 238        /// <param name="cancellationToken"> The cancellation token to use. </param>
 239        public async Task<Response<ProviderListResult>> ListAsync(int? top = null, string expand = null, CancellationTok
 240        {
 6241            using var message = CreateListRequest(top, expand);
 6242            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6243            switch (message.Response.Status)
 244            {
 245                case 200:
 246                    {
 6247                        ProviderListResult value = default;
 6248                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6249                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 250                        {
 0251                            value = null;
 252                        }
 253                        else
 254                        {
 6255                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 256                        }
 6257                        return Response.FromValue(value, message.Response);
 258                    }
 259                default:
 0260                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 261            }
 6262        }
 263
 264        /// <summary> Gets all resource providers for a subscription. </summary>
 265        /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param>
 266        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 267        /// <param name="cancellationToken"> The cancellation token to use. </param>
 268        public Response<ProviderListResult> List(int? top = null, string expand = null, CancellationToken cancellationTo
 269        {
 6270            using var message = CreateListRequest(top, expand);
 6271            _pipeline.Send(message, cancellationToken);
 6272            switch (message.Response.Status)
 273            {
 274                case 200:
 275                    {
 6276                        ProviderListResult value = default;
 6277                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6278                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 279                        {
 0280                            value = null;
 281                        }
 282                        else
 283                        {
 6284                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 285                        }
 6286                        return Response.FromValue(value, message.Response);
 287                    }
 288                default:
 0289                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 290            }
 6291        }
 292
 293        internal Core.HttpMessage CreateListAtTenantScopeRequest(int? top, string expand)
 294        {
 0295            var message = _pipeline.CreateMessage();
 0296            var request = message.Request;
 0297            request.Method = RequestMethod.Get;
 0298            var uri = new RawRequestUriBuilder();
 0299            uri.Reset(endpoint);
 0300            uri.AppendPath("/providers", false);
 0301            if (top != null)
 302            {
 0303                uri.AppendQuery("$top", top.Value, true);
 304            }
 0305            if (expand != null)
 306            {
 0307                uri.AppendQuery("$expand", expand, true);
 308            }
 0309            uri.AppendQuery("api-version", "2019-10-01", true);
 0310            request.Uri = uri;
 0311            return message;
 312        }
 313
 314        /// <summary> Gets all resource providers for the tenant. </summary>
 315        /// <param name="top"> The number of results to return. If null is passed returns all providers. </param>
 316        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 317        /// <param name="cancellationToken"> The cancellation token to use. </param>
 318        public async Task<Response<ProviderListResult>> ListAtTenantScopeAsync(int? top = null, string expand = null, Ca
 319        {
 0320            using var message = CreateListAtTenantScopeRequest(top, expand);
 0321            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0322            switch (message.Response.Status)
 323            {
 324                case 200:
 325                    {
 0326                        ProviderListResult value = default;
 0327                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0328                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 329                        {
 0330                            value = null;
 331                        }
 332                        else
 333                        {
 0334                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 335                        }
 0336                        return Response.FromValue(value, message.Response);
 337                    }
 338                default:
 0339                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 340            }
 0341        }
 342
 343        /// <summary> Gets all resource providers for the tenant. </summary>
 344        /// <param name="top"> The number of results to return. If null is passed returns all providers. </param>
 345        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 346        /// <param name="cancellationToken"> The cancellation token to use. </param>
 347        public Response<ProviderListResult> ListAtTenantScope(int? top = null, string expand = null, CancellationToken c
 348        {
 0349            using var message = CreateListAtTenantScopeRequest(top, expand);
 0350            _pipeline.Send(message, cancellationToken);
 0351            switch (message.Response.Status)
 352            {
 353                case 200:
 354                    {
 0355                        ProviderListResult value = default;
 0356                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0357                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 358                        {
 0359                            value = null;
 360                        }
 361                        else
 362                        {
 0363                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 364                        }
 0365                        return Response.FromValue(value, message.Response);
 366                    }
 367                default:
 0368                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 369            }
 0370        }
 371
 372        internal Core.HttpMessage CreateGetRequest(string resourceProviderNamespace, string expand)
 373        {
 24374            var message = _pipeline.CreateMessage();
 24375            var request = message.Request;
 24376            request.Method = RequestMethod.Get;
 24377            var uri = new RawRequestUriBuilder();
 24378            uri.Reset(endpoint);
 24379            uri.AppendPath("/subscriptions/", false);
 24380            uri.AppendPath(subscriptionId, true);
 24381            uri.AppendPath("/providers/", false);
 24382            uri.AppendPath(resourceProviderNamespace, true);
 24383            if (expand != null)
 384            {
 8385                uri.AppendQuery("$expand", expand, true);
 386            }
 24387            uri.AppendQuery("api-version", "2019-10-01", true);
 24388            request.Uri = uri;
 24389            return message;
 390        }
 391
 392        /// <summary> Gets the specified resource provider. </summary>
 393        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 394        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 395        /// <param name="cancellationToken"> The cancellation token to use. </param>
 396        public async Task<Response<Provider>> GetAsync(string resourceProviderNamespace, string expand = null, Cancellat
 397        {
 14398            if (resourceProviderNamespace == null)
 399            {
 2400                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 401            }
 402
 12403            using var message = CreateGetRequest(resourceProviderNamespace, expand);
 12404            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 12405            switch (message.Response.Status)
 406            {
 407                case 200:
 408                    {
 12409                        Provider value = default;
 12410                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 12411                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 412                        {
 0413                            value = null;
 414                        }
 415                        else
 416                        {
 12417                            value = Provider.DeserializeProvider(document.RootElement);
 418                        }
 12419                        return Response.FromValue(value, message.Response);
 420                    }
 421                default:
 0422                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 423            }
 12424        }
 425
 426        /// <summary> Gets the specified resource provider. </summary>
 427        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 428        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 429        /// <param name="cancellationToken"> The cancellation token to use. </param>
 430        public Response<Provider> Get(string resourceProviderNamespace, string expand = null, CancellationToken cancella
 431        {
 14432            if (resourceProviderNamespace == null)
 433            {
 2434                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 435            }
 436
 12437            using var message = CreateGetRequest(resourceProviderNamespace, expand);
 12438            _pipeline.Send(message, cancellationToken);
 12439            switch (message.Response.Status)
 440            {
 441                case 200:
 442                    {
 12443                        Provider value = default;
 12444                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 12445                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 446                        {
 0447                            value = null;
 448                        }
 449                        else
 450                        {
 12451                            value = Provider.DeserializeProvider(document.RootElement);
 452                        }
 12453                        return Response.FromValue(value, message.Response);
 454                    }
 455                default:
 0456                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 457            }
 12458        }
 459
 460        internal Core.HttpMessage CreateGetAtTenantScopeRequest(string resourceProviderNamespace, string expand)
 461        {
 0462            var message = _pipeline.CreateMessage();
 0463            var request = message.Request;
 0464            request.Method = RequestMethod.Get;
 0465            var uri = new RawRequestUriBuilder();
 0466            uri.Reset(endpoint);
 0467            uri.AppendPath("/providers/", false);
 0468            uri.AppendPath(resourceProviderNamespace, true);
 0469            if (expand != null)
 470            {
 0471                uri.AppendQuery("$expand", expand, true);
 472            }
 0473            uri.AppendQuery("api-version", "2019-10-01", true);
 0474            request.Uri = uri;
 0475            return message;
 476        }
 477
 478        /// <summary> Gets the specified resource provider at the tenant level. </summary>
 479        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 480        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 481        /// <param name="cancellationToken"> The cancellation token to use. </param>
 482        public async Task<Response<Provider>> GetAtTenantScopeAsync(string resourceProviderNamespace, string expand = nu
 483        {
 0484            if (resourceProviderNamespace == null)
 485            {
 0486                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 487            }
 488
 0489            using var message = CreateGetAtTenantScopeRequest(resourceProviderNamespace, expand);
 0490            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0491            switch (message.Response.Status)
 492            {
 493                case 200:
 494                    {
 0495                        Provider value = default;
 0496                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0497                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 498                        {
 0499                            value = null;
 500                        }
 501                        else
 502                        {
 0503                            value = Provider.DeserializeProvider(document.RootElement);
 504                        }
 0505                        return Response.FromValue(value, message.Response);
 506                    }
 507                default:
 0508                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 509            }
 0510        }
 511
 512        /// <summary> Gets the specified resource provider at the tenant level. </summary>
 513        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 514        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 515        /// <param name="cancellationToken"> The cancellation token to use. </param>
 516        public Response<Provider> GetAtTenantScope(string resourceProviderNamespace, string expand = null, CancellationT
 517        {
 0518            if (resourceProviderNamespace == null)
 519            {
 0520                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 521            }
 522
 0523            using var message = CreateGetAtTenantScopeRequest(resourceProviderNamespace, expand);
 0524            _pipeline.Send(message, cancellationToken);
 0525            switch (message.Response.Status)
 526            {
 527                case 200:
 528                    {
 0529                        Provider value = default;
 0530                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0531                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 532                        {
 0533                            value = null;
 534                        }
 535                        else
 536                        {
 0537                            value = Provider.DeserializeProvider(document.RootElement);
 538                        }
 0539                        return Response.FromValue(value, message.Response);
 540                    }
 541                default:
 0542                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 543            }
 0544        }
 545
 546        internal Core.HttpMessage CreateListNextPageRequest(string nextLink, int? top, string expand)
 547        {
 0548            var message = _pipeline.CreateMessage();
 0549            var request = message.Request;
 0550            request.Method = RequestMethod.Get;
 0551            var uri = new RawRequestUriBuilder();
 0552            uri.Reset(endpoint);
 0553            uri.AppendRawNextLink(nextLink, false);
 0554            request.Uri = uri;
 0555            return message;
 556        }
 557
 558        /// <summary> Gets all resource providers for a subscription. </summary>
 559        /// <param name="nextLink"> The URL to the next page of results. </param>
 560        /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param>
 561        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 562        /// <param name="cancellationToken"> The cancellation token to use. </param>
 563        public async Task<Response<ProviderListResult>> ListNextPageAsync(string nextLink, int? top = null, string expan
 564        {
 0565            if (nextLink == null)
 566            {
 0567                throw new ArgumentNullException(nameof(nextLink));
 568            }
 569
 0570            using var message = CreateListNextPageRequest(nextLink, top, expand);
 0571            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0572            switch (message.Response.Status)
 573            {
 574                case 200:
 575                    {
 0576                        ProviderListResult value = default;
 0577                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0578                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 579                        {
 0580                            value = null;
 581                        }
 582                        else
 583                        {
 0584                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 585                        }
 0586                        return Response.FromValue(value, message.Response);
 587                    }
 588                default:
 0589                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 590            }
 0591        }
 592
 593        /// <summary> Gets all resource providers for a subscription. </summary>
 594        /// <param name="nextLink"> The URL to the next page of results. </param>
 595        /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param>
 596        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 597        /// <param name="cancellationToken"> The cancellation token to use. </param>
 598        public Response<ProviderListResult> ListNextPage(string nextLink, int? top = null, string expand = null, Cancell
 599        {
 0600            if (nextLink == null)
 601            {
 0602                throw new ArgumentNullException(nameof(nextLink));
 603            }
 604
 0605            using var message = CreateListNextPageRequest(nextLink, top, expand);
 0606            _pipeline.Send(message, cancellationToken);
 0607            switch (message.Response.Status)
 608            {
 609                case 200:
 610                    {
 0611                        ProviderListResult value = default;
 0612                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0613                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 614                        {
 0615                            value = null;
 616                        }
 617                        else
 618                        {
 0619                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 620                        }
 0621                        return Response.FromValue(value, message.Response);
 622                    }
 623                default:
 0624                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 625            }
 0626        }
 627
 628        internal Core.HttpMessage CreateListAtTenantScopeNextPageRequest(string nextLink, int? top, string expand)
 629        {
 0630            var message = _pipeline.CreateMessage();
 0631            var request = message.Request;
 0632            request.Method = RequestMethod.Get;
 0633            var uri = new RawRequestUriBuilder();
 0634            uri.Reset(endpoint);
 0635            uri.AppendRawNextLink(nextLink, false);
 0636            request.Uri = uri;
 0637            return message;
 638        }
 639
 640        /// <summary> Gets all resource providers for the tenant. </summary>
 641        /// <param name="nextLink"> The URL to the next page of results. </param>
 642        /// <param name="top"> The number of results to return. If null is passed returns all providers. </param>
 643        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 644        /// <param name="cancellationToken"> The cancellation token to use. </param>
 645        public async Task<Response<ProviderListResult>> ListAtTenantScopeNextPageAsync(string nextLink, int? top = null,
 646        {
 0647            if (nextLink == null)
 648            {
 0649                throw new ArgumentNullException(nameof(nextLink));
 650            }
 651
 0652            using var message = CreateListAtTenantScopeNextPageRequest(nextLink, top, expand);
 0653            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0654            switch (message.Response.Status)
 655            {
 656                case 200:
 657                    {
 0658                        ProviderListResult value = default;
 0659                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0660                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 661                        {
 0662                            value = null;
 663                        }
 664                        else
 665                        {
 0666                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 667                        }
 0668                        return Response.FromValue(value, message.Response);
 669                    }
 670                default:
 0671                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 672            }
 0673        }
 674
 675        /// <summary> Gets all resource providers for the tenant. </summary>
 676        /// <param name="nextLink"> The URL to the next page of results. </param>
 677        /// <param name="top"> The number of results to return. If null is passed returns all providers. </param>
 678        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 679        /// <param name="cancellationToken"> The cancellation token to use. </param>
 680        public Response<ProviderListResult> ListAtTenantScopeNextPage(string nextLink, int? top = null, string expand = 
 681        {
 0682            if (nextLink == null)
 683            {
 0684                throw new ArgumentNullException(nameof(nextLink));
 685            }
 686
 0687            using var message = CreateListAtTenantScopeNextPageRequest(nextLink, top, expand);
 0688            _pipeline.Send(message, cancellationToken);
 0689            switch (message.Response.Status)
 690            {
 691                case 200:
 692                    {
 0693                        ProviderListResult value = default;
 0694                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0695                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 696                        {
 0697                            value = null;
 698                        }
 699                        else
 700                        {
 0701                            value = ProviderListResult.DeserializeProviderListResult(document.RootElement);
 702                        }
 0703                        return Response.FromValue(value, message.Response);
 704                    }
 705                default:
 0706                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 707            }
 0708        }
 709    }
 710}