< Summary

Class:Azure.ResourceManager.Resources.ResourceLinksRestOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ResourceLinksRestOperations.cs
Covered lines:159
Uncovered lines:101
Coverable lines:260
Total lines:605
Line coverage:61.1% (159 of 260)
Covered branches:34
Total branches:94
Branch coverage:36.1% (34 of 94)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-75%50%
Delete(...)-75%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-73.33%50%
CreateOrUpdate(...)-73.33%50%
CreateGetRequest(...)-100%100%
GetAsync()-76.92%50%
Get(...)-76.92%50%
CreateListAtSubscriptionRequest(...)-100%100%
ListAtSubscriptionAsync()-81.82%50%
ListAtSubscription(...)-81.82%50%
CreateListAtSourceScopeRequest(...)-100%100%
ListAtSourceScopeAsync()-76.92%50%
ListAtSourceScope(...)-76.92%50%
CreateListAtSubscriptionNextPageRequest(...)-0%100%
ListAtSubscriptionNextPageAsync()-0%0%
ListAtSubscriptionNextPage(...)-0%0%
CreateListAtSourceScopeNextPageRequest(...)-0%100%
ListAtSourceScopeNextPageAsync()-0%0%
ListAtSourceScopeNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ResourceLinksRestOperations.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 ResourceLinksRestOperations
 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 ResourceLinksRestOperations. </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
 2832        public ResourceLinksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti
 33        {
 2834            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 2838            endpoint ??= new Uri("https://management.azure.com");
 39
 2840            this.subscriptionId = subscriptionId;
 2841            this.endpoint = endpoint;
 2842            _clientDiagnostics = clientDiagnostics;
 2843            _pipeline = pipeline;
 2844        }
 45
 46        internal Core.HttpMessage CreateDeleteRequest(string linkId)
 47        {
 448            var message = _pipeline.CreateMessage();
 449            var request = message.Request;
 450            request.Method = RequestMethod.Delete;
 451            var uri = new RawRequestUriBuilder();
 452            uri.Reset(endpoint);
 453            uri.AppendPath("/", false);
 454            uri.AppendPath(linkId, false);
 455            uri.AppendQuery("api-version", "2016-09-01", true);
 456            request.Uri = uri;
 457            return message;
 58        }
 59
 60        /// <summary> Deletes a resource link with the specified ID. </summary>
 61        /// <param name="linkId"> The fully qualified ID of the resource link. Use the format, /subscriptions/{subscript
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public async Task<Response> DeleteAsync(string linkId, CancellationToken cancellationToken = default)
 64        {
 265            if (linkId == null)
 66            {
 067                throw new ArgumentNullException(nameof(linkId));
 68            }
 69
 270            using var message = CreateDeleteRequest(linkId);
 271            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 272            switch (message.Response.Status)
 73            {
 74                case 200:
 75                case 204:
 276                    return message.Response;
 77                default:
 078                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 79            }
 280        }
 81
 82        /// <summary> Deletes a resource link with the specified ID. </summary>
 83        /// <param name="linkId"> The fully qualified ID of the resource link. Use the format, /subscriptions/{subscript
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public Response Delete(string linkId, CancellationToken cancellationToken = default)
 86        {
 287            if (linkId == null)
 88            {
 089                throw new ArgumentNullException(nameof(linkId));
 90            }
 91
 292            using var message = CreateDeleteRequest(linkId);
 293            _pipeline.Send(message, cancellationToken);
 294            switch (message.Response.Status)
 95            {
 96                case 200:
 97                case 204:
 298                    return message.Response;
 99                default:
 0100                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 101            }
 2102        }
 103
 104        internal Core.HttpMessage CreateCreateOrUpdateRequest(string linkId, ResourceLink parameters)
 105        {
 4106            var message = _pipeline.CreateMessage();
 4107            var request = message.Request;
 4108            request.Method = RequestMethod.Put;
 4109            var uri = new RawRequestUriBuilder();
 4110            uri.Reset(endpoint);
 4111            uri.AppendPath("/", false);
 4112            uri.AppendPath(linkId, false);
 4113            uri.AppendQuery("api-version", "2016-09-01", true);
 4114            request.Uri = uri;
 4115            request.Headers.Add("Content-Type", "application/json");
 4116            var content = new Utf8JsonRequestContent();
 4117            content.JsonWriter.WriteObjectValue(parameters);
 4118            request.Content = content;
 4119            return message;
 120        }
 121
 122        /// <summary> Creates or updates a resource link between the specified resources. </summary>
 123        /// <param name="linkId"> The fully qualified ID of the resource link. Use the format, /subscriptions/{subscript
 124        /// <param name="parameters"> Parameters for creating or updating a resource link. </param>
 125        /// <param name="cancellationToken"> The cancellation token to use. </param>
 126        public async Task<Response<ResourceLink>> CreateOrUpdateAsync(string linkId, ResourceLink parameters, Cancellati
 127        {
 2128            if (linkId == null)
 129            {
 0130                throw new ArgumentNullException(nameof(linkId));
 131            }
 2132            if (parameters == null)
 133            {
 0134                throw new ArgumentNullException(nameof(parameters));
 135            }
 136
 2137            using var message = CreateCreateOrUpdateRequest(linkId, parameters);
 2138            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2139            switch (message.Response.Status)
 140            {
 141                case 200:
 142                case 201:
 143                    {
 2144                        ResourceLink value = default;
 2145                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2146                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 147                        {
 0148                            value = null;
 149                        }
 150                        else
 151                        {
 2152                            value = ResourceLink.DeserializeResourceLink(document.RootElement);
 153                        }
 2154                        return Response.FromValue(value, message.Response);
 155                    }
 156                default:
 0157                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 158            }
 2159        }
 160
 161        /// <summary> Creates or updates a resource link between the specified resources. </summary>
 162        /// <param name="linkId"> The fully qualified ID of the resource link. Use the format, /subscriptions/{subscript
 163        /// <param name="parameters"> Parameters for creating or updating a resource link. </param>
 164        /// <param name="cancellationToken"> The cancellation token to use. </param>
 165        public Response<ResourceLink> CreateOrUpdate(string linkId, ResourceLink parameters, CancellationToken cancellat
 166        {
 2167            if (linkId == null)
 168            {
 0169                throw new ArgumentNullException(nameof(linkId));
 170            }
 2171            if (parameters == null)
 172            {
 0173                throw new ArgumentNullException(nameof(parameters));
 174            }
 175
 2176            using var message = CreateCreateOrUpdateRequest(linkId, parameters);
 2177            _pipeline.Send(message, cancellationToken);
 2178            switch (message.Response.Status)
 179            {
 180                case 200:
 181                case 201:
 182                    {
 2183                        ResourceLink value = default;
 2184                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2185                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 186                        {
 0187                            value = null;
 188                        }
 189                        else
 190                        {
 2191                            value = ResourceLink.DeserializeResourceLink(document.RootElement);
 192                        }
 2193                        return Response.FromValue(value, message.Response);
 194                    }
 195                default:
 0196                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 197            }
 2198        }
 199
 200        internal Core.HttpMessage CreateGetRequest(string linkId)
 201        {
 8202            var message = _pipeline.CreateMessage();
 8203            var request = message.Request;
 8204            request.Method = RequestMethod.Get;
 8205            var uri = new RawRequestUriBuilder();
 8206            uri.Reset(endpoint);
 8207            uri.AppendPath("/", false);
 8208            uri.AppendPath(linkId, false);
 8209            uri.AppendQuery("api-version", "2016-09-01", true);
 8210            request.Uri = uri;
 8211            return message;
 212        }
 213
 214        /// <summary> Gets a resource link with the specified ID. </summary>
 215        /// <param name="linkId"> The fully qualified Id of the resource link. For example, /subscriptions/00000000-0000
 216        /// <param name="cancellationToken"> The cancellation token to use. </param>
 217        public async Task<Response<ResourceLink>> GetAsync(string linkId, CancellationToken cancellationToken = default)
 218        {
 4219            if (linkId == null)
 220            {
 0221                throw new ArgumentNullException(nameof(linkId));
 222            }
 223
 4224            using var message = CreateGetRequest(linkId);
 4225            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2226            switch (message.Response.Status)
 227            {
 228                case 200:
 229                    {
 2230                        ResourceLink value = default;
 2231                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2232                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 233                        {
 0234                            value = null;
 235                        }
 236                        else
 237                        {
 2238                            value = ResourceLink.DeserializeResourceLink(document.RootElement);
 239                        }
 2240                        return Response.FromValue(value, message.Response);
 241                    }
 242                default:
 0243                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 244            }
 2245        }
 246
 247        /// <summary> Gets a resource link with the specified ID. </summary>
 248        /// <param name="linkId"> The fully qualified Id of the resource link. For example, /subscriptions/00000000-0000
 249        /// <param name="cancellationToken"> The cancellation token to use. </param>
 250        public Response<ResourceLink> Get(string linkId, CancellationToken cancellationToken = default)
 251        {
 4252            if (linkId == null)
 253            {
 0254                throw new ArgumentNullException(nameof(linkId));
 255            }
 256
 4257            using var message = CreateGetRequest(linkId);
 4258            _pipeline.Send(message, cancellationToken);
 2259            switch (message.Response.Status)
 260            {
 261                case 200:
 262                    {
 2263                        ResourceLink value = default;
 2264                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2265                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 266                        {
 0267                            value = null;
 268                        }
 269                        else
 270                        {
 2271                            value = ResourceLink.DeserializeResourceLink(document.RootElement);
 272                        }
 2273                        return Response.FromValue(value, message.Response);
 274                    }
 275                default:
 0276                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 277            }
 2278        }
 279
 280        internal Core.HttpMessage CreateListAtSubscriptionRequest(string filter)
 281        {
 8282            var message = _pipeline.CreateMessage();
 8283            var request = message.Request;
 8284            request.Method = RequestMethod.Get;
 8285            var uri = new RawRequestUriBuilder();
 8286            uri.Reset(endpoint);
 8287            uri.AppendPath("/subscriptions/", false);
 8288            uri.AppendPath(subscriptionId, true);
 8289            uri.AppendPath("/providers/Microsoft.Resources/links", false);
 8290            if (filter != null)
 291            {
 4292                uri.AppendQuery("$filter", filter, true);
 293            }
 8294            uri.AppendQuery("api-version", "2016-09-01", true);
 8295            request.Uri = uri;
 8296            return message;
 297        }
 298
 299        /// <summary> Gets all the linked resources for the subscription. </summary>
 300        /// <param name="filter"> The filter to apply on the list resource links operation. The supported filter for lis
 301        /// <param name="cancellationToken"> The cancellation token to use. </param>
 302        public async Task<Response<ResourceLinkResult>> ListAtSubscriptionAsync(string filter = null, CancellationToken 
 303        {
 4304            using var message = CreateListAtSubscriptionRequest(filter);
 4305            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4306            switch (message.Response.Status)
 307            {
 308                case 200:
 309                    {
 4310                        ResourceLinkResult value = default;
 4311                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4312                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 313                        {
 0314                            value = null;
 315                        }
 316                        else
 317                        {
 4318                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 319                        }
 4320                        return Response.FromValue(value, message.Response);
 321                    }
 322                default:
 0323                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 324            }
 4325        }
 326
 327        /// <summary> Gets all the linked resources for the subscription. </summary>
 328        /// <param name="filter"> The filter to apply on the list resource links operation. The supported filter for lis
 329        /// <param name="cancellationToken"> The cancellation token to use. </param>
 330        public Response<ResourceLinkResult> ListAtSubscription(string filter = null, CancellationToken cancellationToken
 331        {
 4332            using var message = CreateListAtSubscriptionRequest(filter);
 4333            _pipeline.Send(message, cancellationToken);
 4334            switch (message.Response.Status)
 335            {
 336                case 200:
 337                    {
 4338                        ResourceLinkResult value = default;
 4339                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4340                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 341                        {
 0342                            value = null;
 343                        }
 344                        else
 345                        {
 4346                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 347                        }
 4348                        return Response.FromValue(value, message.Response);
 349                    }
 350                default:
 0351                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 352            }
 4353        }
 354
 355        internal Core.HttpMessage CreateListAtSourceScopeRequest(string scope)
 356        {
 4357            var message = _pipeline.CreateMessage();
 4358            var request = message.Request;
 4359            request.Method = RequestMethod.Get;
 4360            var uri = new RawRequestUriBuilder();
 4361            uri.Reset(endpoint);
 4362            uri.AppendPath("/", false);
 4363            uri.AppendPath(scope, false);
 4364            uri.AppendPath("/providers/Microsoft.Resources/links", false);
 4365            uri.AppendQuery("$filter", "atScope()", true);
 4366            uri.AppendQuery("api-version", "2016-09-01", true);
 4367            request.Uri = uri;
 4368            return message;
 369        }
 370
 371        /// <summary> Gets a list of resource links at and below the specified source scope. </summary>
 372        /// <param name="scope"> The fully qualified ID of the scope for getting the resource links. For example, to lis
 373        /// <param name="cancellationToken"> The cancellation token to use. </param>
 374        public async Task<Response<ResourceLinkResult>> ListAtSourceScopeAsync(string scope, CancellationToken cancellat
 375        {
 2376            if (scope == null)
 377            {
 0378                throw new ArgumentNullException(nameof(scope));
 379            }
 380
 2381            using var message = CreateListAtSourceScopeRequest(scope);
 2382            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2383            switch (message.Response.Status)
 384            {
 385                case 200:
 386                    {
 2387                        ResourceLinkResult value = default;
 2388                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2389                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 390                        {
 0391                            value = null;
 392                        }
 393                        else
 394                        {
 2395                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 396                        }
 2397                        return Response.FromValue(value, message.Response);
 398                    }
 399                default:
 0400                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 401            }
 2402        }
 403
 404        /// <summary> Gets a list of resource links at and below the specified source scope. </summary>
 405        /// <param name="scope"> The fully qualified ID of the scope for getting the resource links. For example, to lis
 406        /// <param name="cancellationToken"> The cancellation token to use. </param>
 407        public Response<ResourceLinkResult> ListAtSourceScope(string scope, CancellationToken cancellationToken = defaul
 408        {
 2409            if (scope == null)
 410            {
 0411                throw new ArgumentNullException(nameof(scope));
 412            }
 413
 2414            using var message = CreateListAtSourceScopeRequest(scope);
 2415            _pipeline.Send(message, cancellationToken);
 2416            switch (message.Response.Status)
 417            {
 418                case 200:
 419                    {
 2420                        ResourceLinkResult value = default;
 2421                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2422                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 423                        {
 0424                            value = null;
 425                        }
 426                        else
 427                        {
 2428                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 429                        }
 2430                        return Response.FromValue(value, message.Response);
 431                    }
 432                default:
 0433                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 434            }
 2435        }
 436
 437        internal Core.HttpMessage CreateListAtSubscriptionNextPageRequest(string nextLink, string filter)
 438        {
 0439            var message = _pipeline.CreateMessage();
 0440            var request = message.Request;
 0441            request.Method = RequestMethod.Get;
 0442            var uri = new RawRequestUriBuilder();
 0443            uri.Reset(endpoint);
 0444            uri.AppendRawNextLink(nextLink, false);
 0445            request.Uri = uri;
 0446            return message;
 447        }
 448
 449        /// <summary> Gets all the linked resources for the subscription. </summary>
 450        /// <param name="nextLink"> The URL to the next page of results. </param>
 451        /// <param name="filter"> The filter to apply on the list resource links operation. The supported filter for lis
 452        /// <param name="cancellationToken"> The cancellation token to use. </param>
 453        public async Task<Response<ResourceLinkResult>> ListAtSubscriptionNextPageAsync(string nextLink, string filter =
 454        {
 0455            if (nextLink == null)
 456            {
 0457                throw new ArgumentNullException(nameof(nextLink));
 458            }
 459
 0460            using var message = CreateListAtSubscriptionNextPageRequest(nextLink, filter);
 0461            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0462            switch (message.Response.Status)
 463            {
 464                case 200:
 465                    {
 0466                        ResourceLinkResult value = default;
 0467                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0468                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 469                        {
 0470                            value = null;
 471                        }
 472                        else
 473                        {
 0474                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 475                        }
 0476                        return Response.FromValue(value, message.Response);
 477                    }
 478                default:
 0479                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 480            }
 0481        }
 482
 483        /// <summary> Gets all the linked resources for the subscription. </summary>
 484        /// <param name="nextLink"> The URL to the next page of results. </param>
 485        /// <param name="filter"> The filter to apply on the list resource links operation. The supported filter for lis
 486        /// <param name="cancellationToken"> The cancellation token to use. </param>
 487        public Response<ResourceLinkResult> ListAtSubscriptionNextPage(string nextLink, string filter = null, Cancellati
 488        {
 0489            if (nextLink == null)
 490            {
 0491                throw new ArgumentNullException(nameof(nextLink));
 492            }
 493
 0494            using var message = CreateListAtSubscriptionNextPageRequest(nextLink, filter);
 0495            _pipeline.Send(message, cancellationToken);
 0496            switch (message.Response.Status)
 497            {
 498                case 200:
 499                    {
 0500                        ResourceLinkResult value = default;
 0501                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0502                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 503                        {
 0504                            value = null;
 505                        }
 506                        else
 507                        {
 0508                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 509                        }
 0510                        return Response.FromValue(value, message.Response);
 511                    }
 512                default:
 0513                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 514            }
 0515        }
 516
 517        internal Core.HttpMessage CreateListAtSourceScopeNextPageRequest(string nextLink, string scope)
 518        {
 0519            var message = _pipeline.CreateMessage();
 0520            var request = message.Request;
 0521            request.Method = RequestMethod.Get;
 0522            var uri = new RawRequestUriBuilder();
 0523            uri.Reset(endpoint);
 0524            uri.AppendRawNextLink(nextLink, false);
 0525            request.Uri = uri;
 0526            return message;
 527        }
 528
 529        /// <summary> Gets a list of resource links at and below the specified source scope. </summary>
 530        /// <param name="nextLink"> The URL to the next page of results. </param>
 531        /// <param name="scope"> The fully qualified ID of the scope for getting the resource links. For example, to lis
 532        /// <param name="cancellationToken"> The cancellation token to use. </param>
 533        public async Task<Response<ResourceLinkResult>> ListAtSourceScopeNextPageAsync(string nextLink, string scope, Ca
 534        {
 0535            if (nextLink == null)
 536            {
 0537                throw new ArgumentNullException(nameof(nextLink));
 538            }
 0539            if (scope == null)
 540            {
 0541                throw new ArgumentNullException(nameof(scope));
 542            }
 543
 0544            using var message = CreateListAtSourceScopeNextPageRequest(nextLink, scope);
 0545            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0546            switch (message.Response.Status)
 547            {
 548                case 200:
 549                    {
 0550                        ResourceLinkResult value = default;
 0551                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0552                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 553                        {
 0554                            value = null;
 555                        }
 556                        else
 557                        {
 0558                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 559                        }
 0560                        return Response.FromValue(value, message.Response);
 561                    }
 562                default:
 0563                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 564            }
 0565        }
 566
 567        /// <summary> Gets a list of resource links at and below the specified source scope. </summary>
 568        /// <param name="nextLink"> The URL to the next page of results. </param>
 569        /// <param name="scope"> The fully qualified ID of the scope for getting the resource links. For example, to lis
 570        /// <param name="cancellationToken"> The cancellation token to use. </param>
 571        public Response<ResourceLinkResult> ListAtSourceScopeNextPage(string nextLink, string scope, CancellationToken c
 572        {
 0573            if (nextLink == null)
 574            {
 0575                throw new ArgumentNullException(nameof(nextLink));
 576            }
 0577            if (scope == null)
 578            {
 0579                throw new ArgumentNullException(nameof(scope));
 580            }
 581
 0582            using var message = CreateListAtSourceScopeNextPageRequest(nextLink, scope);
 0583            _pipeline.Send(message, cancellationToken);
 0584            switch (message.Response.Status)
 585            {
 586                case 200:
 587                    {
 0588                        ResourceLinkResult value = default;
 0589                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0590                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 591                        {
 0592                            value = null;
 593                        }
 594                        else
 595                        {
 0596                            value = ResourceLinkResult.DeserializeResourceLinkResult(document.RootElement);
 597                        }
 0598                        return Response.FromValue(value, message.Response);
 599                    }
 600                default:
 0601                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 602            }
 0603        }
 604    }
 605}