< Summary

Class:Azure.ResourceManager.Network.SecurityPartnerProvidersRestOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\SecurityPartnerProvidersRestOperations.cs
Covered lines:0
Uncovered lines:325
Coverable lines:325
Total lines:726
Line coverage:0% (0 of 325)
Covered branches:0
Total branches:124
Branch coverage:0% (0 of 124)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateUpdateTagsRequest(...)-0%100%
UpdateTagsAsync()-0%0%
UpdateTags(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateListRequest()-0%100%
ListAsync()-0%0%
List(...)-0%0%
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\network\Azure.ResourceManager.Network\src\Generated\SecurityPartnerProvidersRestOperations.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.Network.Models;
 16
 17namespace Azure.ResourceManager.Network
 18{
 19    internal partial class SecurityPartnerProvidersRestOperations
 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 SecurityPartnerProvidersRestOperations. </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 subscription credentials which uniquely identify the Microsoft Azure subsc
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 032        public SecurityPartnerProvidersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string
 33        {
 034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 038            endpoint ??= new Uri("https://management.azure.com");
 39
 040            this.subscriptionId = subscriptionId;
 041            this.endpoint = endpoint;
 042            _clientDiagnostics = clientDiagnostics;
 043            _pipeline = pipeline;
 044        }
 45
 46        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string securityPartnerProviderName)
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Delete;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/resourceGroups/", false);
 056            uri.AppendPath(resourceGroupName, true);
 057            uri.AppendPath("/providers/Microsoft.Network/securityPartnerProviders/", false);
 058            uri.AppendPath(securityPartnerProviderName, true);
 059            uri.AppendQuery("api-version", "2020-04-01", true);
 060            request.Uri = uri;
 061            return message;
 62        }
 63
 64        /// <summary> Deletes the specified Security Partner Provider. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. </param>
 66        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response> DeleteAsync(string resourceGroupName, string securityPartnerProviderName, Cancellati
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (securityPartnerProviderName == null)
 75            {
 076                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 77            }
 78
 079            using var message = CreateDeleteRequest(resourceGroupName, securityPartnerProviderName);
 080            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 081            switch (message.Response.Status)
 82            {
 83                case 200:
 84                case 202:
 85                case 204:
 086                    return message.Response;
 87                default:
 088                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 89            }
 090        }
 91
 92        /// <summary> Deletes the specified Security Partner Provider. </summary>
 93        /// <param name="resourceGroupName"> The name of the resource group. </param>
 94        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 95        /// <param name="cancellationToken"> The cancellation token to use. </param>
 96        public Response Delete(string resourceGroupName, string securityPartnerProviderName, CancellationToken cancellat
 97        {
 098            if (resourceGroupName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(resourceGroupName));
 101            }
 0102            if (securityPartnerProviderName == null)
 103            {
 0104                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 105            }
 106
 0107            using var message = CreateDeleteRequest(resourceGroupName, securityPartnerProviderName);
 0108            _pipeline.Send(message, cancellationToken);
 0109            switch (message.Response.Status)
 110            {
 111                case 200:
 112                case 202:
 113                case 204:
 0114                    return message.Response;
 115                default:
 0116                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 117            }
 0118        }
 119
 120        internal HttpMessage CreateGetRequest(string resourceGroupName, string securityPartnerProviderName)
 121        {
 0122            var message = _pipeline.CreateMessage();
 0123            var request = message.Request;
 0124            request.Method = RequestMethod.Get;
 0125            var uri = new RawRequestUriBuilder();
 0126            uri.Reset(endpoint);
 0127            uri.AppendPath("/subscriptions/", false);
 0128            uri.AppendPath(subscriptionId, true);
 0129            uri.AppendPath("/resourceGroups/", false);
 0130            uri.AppendPath(resourceGroupName, true);
 0131            uri.AppendPath("/providers/Microsoft.Network/securityPartnerProviders/", false);
 0132            uri.AppendPath(securityPartnerProviderName, true);
 0133            uri.AppendQuery("api-version", "2020-04-01", true);
 0134            request.Uri = uri;
 0135            return message;
 136        }
 137
 138        /// <summary> Gets the specified Security Partner Provider. </summary>
 139        /// <param name="resourceGroupName"> The name of the resource group. </param>
 140        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 141        /// <param name="cancellationToken"> The cancellation token to use. </param>
 142        public async Task<Response<SecurityPartnerProvider>> GetAsync(string resourceGroupName, string securityPartnerPr
 143        {
 0144            if (resourceGroupName == null)
 145            {
 0146                throw new ArgumentNullException(nameof(resourceGroupName));
 147            }
 0148            if (securityPartnerProviderName == null)
 149            {
 0150                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 151            }
 152
 0153            using var message = CreateGetRequest(resourceGroupName, securityPartnerProviderName);
 0154            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0155            switch (message.Response.Status)
 156            {
 157                case 200:
 158                    {
 0159                        SecurityPartnerProvider value = default;
 0160                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0161                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 162                        {
 0163                            value = null;
 164                        }
 165                        else
 166                        {
 0167                            value = SecurityPartnerProvider.DeserializeSecurityPartnerProvider(document.RootElement);
 168                        }
 0169                        return Response.FromValue(value, message.Response);
 170                    }
 171                default:
 0172                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 173            }
 0174        }
 175
 176        /// <summary> Gets the specified Security Partner Provider. </summary>
 177        /// <param name="resourceGroupName"> The name of the resource group. </param>
 178        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 179        /// <param name="cancellationToken"> The cancellation token to use. </param>
 180        public Response<SecurityPartnerProvider> Get(string resourceGroupName, string securityPartnerProviderName, Cance
 181        {
 0182            if (resourceGroupName == null)
 183            {
 0184                throw new ArgumentNullException(nameof(resourceGroupName));
 185            }
 0186            if (securityPartnerProviderName == null)
 187            {
 0188                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 189            }
 190
 0191            using var message = CreateGetRequest(resourceGroupName, securityPartnerProviderName);
 0192            _pipeline.Send(message, cancellationToken);
 0193            switch (message.Response.Status)
 194            {
 195                case 200:
 196                    {
 0197                        SecurityPartnerProvider value = default;
 0198                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0199                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 200                        {
 0201                            value = null;
 202                        }
 203                        else
 204                        {
 0205                            value = SecurityPartnerProvider.DeserializeSecurityPartnerProvider(document.RootElement);
 206                        }
 0207                        return Response.FromValue(value, message.Response);
 208                    }
 209                default:
 0210                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 211            }
 0212        }
 213
 214        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string securityPartnerProviderName, S
 215        {
 0216            var message = _pipeline.CreateMessage();
 0217            var request = message.Request;
 0218            request.Method = RequestMethod.Put;
 0219            var uri = new RawRequestUriBuilder();
 0220            uri.Reset(endpoint);
 0221            uri.AppendPath("/subscriptions/", false);
 0222            uri.AppendPath(subscriptionId, true);
 0223            uri.AppendPath("/resourceGroups/", false);
 0224            uri.AppendPath(resourceGroupName, true);
 0225            uri.AppendPath("/providers/Microsoft.Network/securityPartnerProviders/", false);
 0226            uri.AppendPath(securityPartnerProviderName, true);
 0227            uri.AppendQuery("api-version", "2020-04-01", true);
 0228            request.Uri = uri;
 0229            request.Headers.Add("Content-Type", "application/json");
 0230            var content = new Utf8JsonRequestContent();
 0231            content.JsonWriter.WriteObjectValue(parameters);
 0232            request.Content = content;
 0233            return message;
 234        }
 235
 236        /// <summary> Creates or updates the specified Security Partner Provider. </summary>
 237        /// <param name="resourceGroupName"> The name of the resource group. </param>
 238        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 239        /// <param name="parameters"> Parameters supplied to the create or update Security Partner Provider operation. <
 240        /// <param name="cancellationToken"> The cancellation token to use. </param>
 241        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string securityPartnerProviderName, Se
 242        {
 0243            if (resourceGroupName == null)
 244            {
 0245                throw new ArgumentNullException(nameof(resourceGroupName));
 246            }
 0247            if (securityPartnerProviderName == null)
 248            {
 0249                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 250            }
 0251            if (parameters == null)
 252            {
 0253                throw new ArgumentNullException(nameof(parameters));
 254            }
 255
 0256            using var message = CreateCreateOrUpdateRequest(resourceGroupName, securityPartnerProviderName, parameters);
 0257            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0258            switch (message.Response.Status)
 259            {
 260                case 200:
 261                case 201:
 0262                    return message.Response;
 263                default:
 0264                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 265            }
 0266        }
 267
 268        /// <summary> Creates or updates the specified Security Partner Provider. </summary>
 269        /// <param name="resourceGroupName"> The name of the resource group. </param>
 270        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 271        /// <param name="parameters"> Parameters supplied to the create or update Security Partner Provider operation. <
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public Response CreateOrUpdate(string resourceGroupName, string securityPartnerProviderName, SecurityPartnerProv
 274        {
 0275            if (resourceGroupName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(resourceGroupName));
 278            }
 0279            if (securityPartnerProviderName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 282            }
 0283            if (parameters == null)
 284            {
 0285                throw new ArgumentNullException(nameof(parameters));
 286            }
 287
 0288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, securityPartnerProviderName, parameters);
 0289            _pipeline.Send(message, cancellationToken);
 0290            switch (message.Response.Status)
 291            {
 292                case 200:
 293                case 201:
 0294                    return message.Response;
 295                default:
 0296                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 297            }
 0298        }
 299
 300        internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string securityPartnerProviderName, TagsO
 301        {
 0302            var message = _pipeline.CreateMessage();
 0303            var request = message.Request;
 0304            request.Method = RequestMethod.Patch;
 0305            var uri = new RawRequestUriBuilder();
 0306            uri.Reset(endpoint);
 0307            uri.AppendPath("/subscriptions/", false);
 0308            uri.AppendPath(subscriptionId, true);
 0309            uri.AppendPath("/resourceGroups/", false);
 0310            uri.AppendPath(resourceGroupName, true);
 0311            uri.AppendPath("/providers/Microsoft.Network/securityPartnerProviders/", false);
 0312            uri.AppendPath(securityPartnerProviderName, true);
 0313            uri.AppendQuery("api-version", "2020-04-01", true);
 0314            request.Uri = uri;
 0315            request.Headers.Add("Content-Type", "application/json");
 0316            var content = new Utf8JsonRequestContent();
 0317            content.JsonWriter.WriteObjectValue(parameters);
 0318            request.Content = content;
 0319            return message;
 320        }
 321
 322        /// <summary> Updates tags of a Security Partner Provider resource. </summary>
 323        /// <param name="resourceGroupName"> The name of the resource group. </param>
 324        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 325        /// <param name="parameters"> Parameters supplied to update Security Partner Provider tags. </param>
 326        /// <param name="cancellationToken"> The cancellation token to use. </param>
 327        public async Task<Response<SecurityPartnerProvider>> UpdateTagsAsync(string resourceGroupName, string securityPa
 328        {
 0329            if (resourceGroupName == null)
 330            {
 0331                throw new ArgumentNullException(nameof(resourceGroupName));
 332            }
 0333            if (securityPartnerProviderName == null)
 334            {
 0335                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 336            }
 0337            if (parameters == null)
 338            {
 0339                throw new ArgumentNullException(nameof(parameters));
 340            }
 341
 0342            using var message = CreateUpdateTagsRequest(resourceGroupName, securityPartnerProviderName, parameters);
 0343            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0344            switch (message.Response.Status)
 345            {
 346                case 200:
 347                    {
 0348                        SecurityPartnerProvider value = default;
 0349                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0350                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 351                        {
 0352                            value = null;
 353                        }
 354                        else
 355                        {
 0356                            value = SecurityPartnerProvider.DeserializeSecurityPartnerProvider(document.RootElement);
 357                        }
 0358                        return Response.FromValue(value, message.Response);
 359                    }
 360                default:
 0361                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 362            }
 0363        }
 364
 365        /// <summary> Updates tags of a Security Partner Provider resource. </summary>
 366        /// <param name="resourceGroupName"> The name of the resource group. </param>
 367        /// <param name="securityPartnerProviderName"> The name of the Security Partner Provider. </param>
 368        /// <param name="parameters"> Parameters supplied to update Security Partner Provider tags. </param>
 369        /// <param name="cancellationToken"> The cancellation token to use. </param>
 370        public Response<SecurityPartnerProvider> UpdateTags(string resourceGroupName, string securityPartnerProviderName
 371        {
 0372            if (resourceGroupName == null)
 373            {
 0374                throw new ArgumentNullException(nameof(resourceGroupName));
 375            }
 0376            if (securityPartnerProviderName == null)
 377            {
 0378                throw new ArgumentNullException(nameof(securityPartnerProviderName));
 379            }
 0380            if (parameters == null)
 381            {
 0382                throw new ArgumentNullException(nameof(parameters));
 383            }
 384
 0385            using var message = CreateUpdateTagsRequest(resourceGroupName, securityPartnerProviderName, parameters);
 0386            _pipeline.Send(message, cancellationToken);
 0387            switch (message.Response.Status)
 388            {
 389                case 200:
 390                    {
 0391                        SecurityPartnerProvider value = default;
 0392                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0393                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 394                        {
 0395                            value = null;
 396                        }
 397                        else
 398                        {
 0399                            value = SecurityPartnerProvider.DeserializeSecurityPartnerProvider(document.RootElement);
 400                        }
 0401                        return Response.FromValue(value, message.Response);
 402                    }
 403                default:
 0404                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 405            }
 0406        }
 407
 408        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 409        {
 0410            var message = _pipeline.CreateMessage();
 0411            var request = message.Request;
 0412            request.Method = RequestMethod.Get;
 0413            var uri = new RawRequestUriBuilder();
 0414            uri.Reset(endpoint);
 0415            uri.AppendPath("/subscriptions/", false);
 0416            uri.AppendPath(subscriptionId, true);
 0417            uri.AppendPath("/resourceGroups/", false);
 0418            uri.AppendPath(resourceGroupName, true);
 0419            uri.AppendPath("/providers/Microsoft.Network/securityPartnerProviders", false);
 0420            uri.AppendQuery("api-version", "2020-04-01", true);
 0421            request.Uri = uri;
 0422            return message;
 423        }
 424
 425        /// <summary> Lists all Security Partner Providers in a resource group. </summary>
 426        /// <param name="resourceGroupName"> The name of the resource group. </param>
 427        /// <param name="cancellationToken"> The cancellation token to use. </param>
 428        public async Task<Response<SecurityPartnerProviderListResult>> ListByResourceGroupAsync(string resourceGroupName
 429        {
 0430            if (resourceGroupName == null)
 431            {
 0432                throw new ArgumentNullException(nameof(resourceGroupName));
 433            }
 434
 0435            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0436            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0437            switch (message.Response.Status)
 438            {
 439                case 200:
 440                    {
 0441                        SecurityPartnerProviderListResult value = default;
 0442                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0443                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 444                        {
 0445                            value = null;
 446                        }
 447                        else
 448                        {
 0449                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 450                        }
 0451                        return Response.FromValue(value, message.Response);
 452                    }
 453                default:
 0454                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 455            }
 0456        }
 457
 458        /// <summary> Lists all Security Partner Providers in a resource group. </summary>
 459        /// <param name="resourceGroupName"> The name of the resource group. </param>
 460        /// <param name="cancellationToken"> The cancellation token to use. </param>
 461        public Response<SecurityPartnerProviderListResult> ListByResourceGroup(string resourceGroupName, CancellationTok
 462        {
 0463            if (resourceGroupName == null)
 464            {
 0465                throw new ArgumentNullException(nameof(resourceGroupName));
 466            }
 467
 0468            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0469            _pipeline.Send(message, cancellationToken);
 0470            switch (message.Response.Status)
 471            {
 472                case 200:
 473                    {
 0474                        SecurityPartnerProviderListResult value = default;
 0475                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0476                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 477                        {
 0478                            value = null;
 479                        }
 480                        else
 481                        {
 0482                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 483                        }
 0484                        return Response.FromValue(value, message.Response);
 485                    }
 486                default:
 0487                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 488            }
 0489        }
 490
 491        internal HttpMessage CreateListRequest()
 492        {
 0493            var message = _pipeline.CreateMessage();
 0494            var request = message.Request;
 0495            request.Method = RequestMethod.Get;
 0496            var uri = new RawRequestUriBuilder();
 0497            uri.Reset(endpoint);
 0498            uri.AppendPath("/subscriptions/", false);
 0499            uri.AppendPath(subscriptionId, true);
 0500            uri.AppendPath("/providers/Microsoft.Network/securityPartnerProviders", false);
 0501            uri.AppendQuery("api-version", "2020-04-01", true);
 0502            request.Uri = uri;
 0503            return message;
 504        }
 505
 506        /// <summary> Gets all the Security Partner Providers in a subscription. </summary>
 507        /// <param name="cancellationToken"> The cancellation token to use. </param>
 508        public async Task<Response<SecurityPartnerProviderListResult>> ListAsync(CancellationToken cancellationToken = d
 509        {
 0510            using var message = CreateListRequest();
 0511            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0512            switch (message.Response.Status)
 513            {
 514                case 200:
 515                    {
 0516                        SecurityPartnerProviderListResult value = default;
 0517                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0518                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 519                        {
 0520                            value = null;
 521                        }
 522                        else
 523                        {
 0524                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 525                        }
 0526                        return Response.FromValue(value, message.Response);
 527                    }
 528                default:
 0529                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 530            }
 0531        }
 532
 533        /// <summary> Gets all the Security Partner Providers in a subscription. </summary>
 534        /// <param name="cancellationToken"> The cancellation token to use. </param>
 535        public Response<SecurityPartnerProviderListResult> List(CancellationToken cancellationToken = default)
 536        {
 0537            using var message = CreateListRequest();
 0538            _pipeline.Send(message, cancellationToken);
 0539            switch (message.Response.Status)
 540            {
 541                case 200:
 542                    {
 0543                        SecurityPartnerProviderListResult value = default;
 0544                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0545                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 546                        {
 0547                            value = null;
 548                        }
 549                        else
 550                        {
 0551                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 552                        }
 0553                        return Response.FromValue(value, message.Response);
 554                    }
 555                default:
 0556                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 557            }
 0558        }
 559
 560        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 561        {
 0562            var message = _pipeline.CreateMessage();
 0563            var request = message.Request;
 0564            request.Method = RequestMethod.Get;
 0565            var uri = new RawRequestUriBuilder();
 0566            uri.Reset(endpoint);
 0567            uri.AppendRawNextLink(nextLink, false);
 0568            request.Uri = uri;
 0569            return message;
 570        }
 571
 572        /// <summary> Lists all Security Partner Providers in a resource group. </summary>
 573        /// <param name="nextLink"> The URL to the next page of results. </param>
 574        /// <param name="resourceGroupName"> The name of the resource group. </param>
 575        /// <param name="cancellationToken"> The cancellation token to use. </param>
 576        public async Task<Response<SecurityPartnerProviderListResult>> ListByResourceGroupNextPageAsync(string nextLink,
 577        {
 0578            if (nextLink == null)
 579            {
 0580                throw new ArgumentNullException(nameof(nextLink));
 581            }
 0582            if (resourceGroupName == null)
 583            {
 0584                throw new ArgumentNullException(nameof(resourceGroupName));
 585            }
 586
 0587            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0588            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0589            switch (message.Response.Status)
 590            {
 591                case 200:
 592                    {
 0593                        SecurityPartnerProviderListResult value = default;
 0594                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0595                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 596                        {
 0597                            value = null;
 598                        }
 599                        else
 600                        {
 0601                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 602                        }
 0603                        return Response.FromValue(value, message.Response);
 604                    }
 605                default:
 0606                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 607            }
 0608        }
 609
 610        /// <summary> Lists all Security Partner Providers in a resource group. </summary>
 611        /// <param name="nextLink"> The URL to the next page of results. </param>
 612        /// <param name="resourceGroupName"> The name of the resource group. </param>
 613        /// <param name="cancellationToken"> The cancellation token to use. </param>
 614        public Response<SecurityPartnerProviderListResult> ListByResourceGroupNextPage(string nextLink, string resourceG
 615        {
 0616            if (nextLink == null)
 617            {
 0618                throw new ArgumentNullException(nameof(nextLink));
 619            }
 0620            if (resourceGroupName == null)
 621            {
 0622                throw new ArgumentNullException(nameof(resourceGroupName));
 623            }
 624
 0625            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0626            _pipeline.Send(message, cancellationToken);
 0627            switch (message.Response.Status)
 628            {
 629                case 200:
 630                    {
 0631                        SecurityPartnerProviderListResult value = default;
 0632                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0633                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 634                        {
 0635                            value = null;
 636                        }
 637                        else
 638                        {
 0639                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 640                        }
 0641                        return Response.FromValue(value, message.Response);
 642                    }
 643                default:
 0644                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 645            }
 0646        }
 647
 648        internal HttpMessage CreateListNextPageRequest(string nextLink)
 649        {
 0650            var message = _pipeline.CreateMessage();
 0651            var request = message.Request;
 0652            request.Method = RequestMethod.Get;
 0653            var uri = new RawRequestUriBuilder();
 0654            uri.Reset(endpoint);
 0655            uri.AppendRawNextLink(nextLink, false);
 0656            request.Uri = uri;
 0657            return message;
 658        }
 659
 660        /// <summary> Gets all the Security Partner Providers in a subscription. </summary>
 661        /// <param name="nextLink"> The URL to the next page of results. </param>
 662        /// <param name="cancellationToken"> The cancellation token to use. </param>
 663        public async Task<Response<SecurityPartnerProviderListResult>> ListNextPageAsync(string nextLink, CancellationTo
 664        {
 0665            if (nextLink == null)
 666            {
 0667                throw new ArgumentNullException(nameof(nextLink));
 668            }
 669
 0670            using var message = CreateListNextPageRequest(nextLink);
 0671            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0672            switch (message.Response.Status)
 673            {
 674                case 200:
 675                    {
 0676                        SecurityPartnerProviderListResult value = default;
 0677                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0678                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 679                        {
 0680                            value = null;
 681                        }
 682                        else
 683                        {
 0684                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 685                        }
 0686                        return Response.FromValue(value, message.Response);
 687                    }
 688                default:
 0689                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 690            }
 0691        }
 692
 693        /// <summary> Gets all the Security Partner Providers in a subscription. </summary>
 694        /// <param name="nextLink"> The URL to the next page of results. </param>
 695        /// <param name="cancellationToken"> The cancellation token to use. </param>
 696        public Response<SecurityPartnerProviderListResult> ListNextPage(string nextLink, CancellationToken cancellationT
 697        {
 0698            if (nextLink == null)
 699            {
 0700                throw new ArgumentNullException(nameof(nextLink));
 701            }
 702
 0703            using var message = CreateListNextPageRequest(nextLink);
 0704            _pipeline.Send(message, cancellationToken);
 0705            switch (message.Response.Status)
 706            {
 707                case 200:
 708                    {
 0709                        SecurityPartnerProviderListResult value = default;
 0710                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0711                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 712                        {
 0713                            value = null;
 714                        }
 715                        else
 716                        {
 0717                            value = SecurityPartnerProviderListResult.DeserializeSecurityPartnerProviderListResult(docum
 718                        }
 0719                        return Response.FromValue(value, message.Response);
 720                    }
 721                default:
 0722                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 723            }
 0724        }
 725    }
 726}