< Summary

Class:Azure.ResourceManager.Resources.PolicyAssignmentsRestOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\PolicyAssignmentsRestOperations.cs
Covered lines:264
Uncovered lines:350
Coverable lines:614
Total lines:1389
Line coverage:42.9% (264 of 614)
Covered branches:65
Total branches:254
Branch coverage:25.5% (65 of 254)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-68.75%40%
Delete(...)-68.75%40%
CreateCreateRequest(...)-100%100%
CreateAsync()-76.47%60%
Create(...)-76.47%60%
CreateGetRequest(...)-100%100%
GetAsync()-80%62.5%
Get(...)-80%62.5%
CreateListForResourceGroupRequest(...)-93.33%50%
ListForResourceGroupAsync()-76.92%50%
ListForResourceGroup(...)-76.92%50%
CreateListForResourceRequest(...)-95.65%50%
ListForResourceAsync()-66.67%50%
ListForResource(...)-66.67%50%
CreateListForManagementGroupRequest(...)-0%100%
ListForManagementGroupAsync()-0%0%
ListForManagementGroup(...)-0%0%
CreateListRequest(...)-92.31%50%
ListAsync()-81.82%50%
List(...)-81.82%50%
CreateDeleteByIdRequest(...)-0%100%
DeleteByIdAsync()-0%0%
DeleteById(...)-0%0%
CreateCreateByIdRequest(...)-0%100%
CreateByIdAsync()-0%0%
CreateById(...)-0%0%
CreateGetByIdRequest(...)-100%100%
GetByIdAsync()-76.92%50%
GetById(...)-76.92%50%
CreateListForResourceGroupNextPageRequest(...)-0%100%
ListForResourceGroupNextPageAsync()-0%0%
ListForResourceGroupNextPage(...)-0%0%
CreateListForResourceNextPageRequest(...)-0%100%
ListForResourceNextPageAsync()-0%0%
ListForResourceNextPage(...)-0%0%
CreateListForManagementGroupNextPageRequest(...)-0%100%
ListForManagementGroupNextPageAsync()-0%0%
ListForManagementGroupNextPage(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\PolicyAssignmentsRestOperations.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 PolicyAssignmentsRestOperations
 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 PolicyAssignmentsRestOperations. </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
 25632        public PolicyAssignmentsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscr
 33        {
 25634            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 25638            endpoint ??= new Uri("https://management.azure.com");
 39
 25640            this.subscriptionId = subscriptionId;
 25641            this.endpoint = endpoint;
 25642            _clientDiagnostics = clientDiagnostics;
 25643            _pipeline = pipeline;
 25644        }
 45
 46        internal Core.HttpMessage CreateDeleteRequest(string scope, string policyAssignmentName)
 47        {
 1648            var message = _pipeline.CreateMessage();
 1649            var request = message.Request;
 1650            request.Method = RequestMethod.Delete;
 1651            var uri = new RawRequestUriBuilder();
 1652            uri.Reset(endpoint);
 1653            uri.AppendPath("/", false);
 1654            uri.AppendPath(scope, false);
 1655            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments/", false);
 1656            uri.AppendPath(policyAssignmentName, true);
 1657            uri.AppendQuery("api-version", "2019-09-01", true);
 1658            request.Uri = uri;
 1659            return message;
 60        }
 61
 62        /// <summary> This operation deletes a policy assignment, given its name and the scope it was created in. The sc
 63        /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: &apos;/
 64        /// <param name="policyAssignmentName"> The name of the policy assignment to delete. </param>
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public async Task<Response<PolicyAssignment>> DeleteAsync(string scope, string policyAssignmentName, Cancellatio
 67        {
 868            if (scope == null)
 69            {
 070                throw new ArgumentNullException(nameof(scope));
 71            }
 872            if (policyAssignmentName == null)
 73            {
 074                throw new ArgumentNullException(nameof(policyAssignmentName));
 75            }
 76
 877            using var message = CreateDeleteRequest(scope, policyAssignmentName);
 878            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 879            switch (message.Response.Status)
 80            {
 81                case 200:
 82                    {
 883                        PolicyAssignment value = default;
 884                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 885                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 86                        {
 087                            value = null;
 88                        }
 89                        else
 90                        {
 891                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 92                        }
 893                        return Response.FromValue(value, message.Response);
 94                    }
 95                case 204:
 096                    return Response.FromValue<PolicyAssignment>(null, message.Response);
 97                default:
 098                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 99            }
 8100        }
 101
 102        /// <summary> This operation deletes a policy assignment, given its name and the scope it was created in. The sc
 103        /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: &apos;/
 104        /// <param name="policyAssignmentName"> The name of the policy assignment to delete. </param>
 105        /// <param name="cancellationToken"> The cancellation token to use. </param>
 106        public Response<PolicyAssignment> Delete(string scope, string policyAssignmentName, CancellationToken cancellati
 107        {
 8108            if (scope == null)
 109            {
 0110                throw new ArgumentNullException(nameof(scope));
 111            }
 8112            if (policyAssignmentName == null)
 113            {
 0114                throw new ArgumentNullException(nameof(policyAssignmentName));
 115            }
 116
 8117            using var message = CreateDeleteRequest(scope, policyAssignmentName);
 8118            _pipeline.Send(message, cancellationToken);
 8119            switch (message.Response.Status)
 120            {
 121                case 200:
 122                    {
 8123                        PolicyAssignment value = default;
 8124                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 8125                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 126                        {
 0127                            value = null;
 128                        }
 129                        else
 130                        {
 8131                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 132                        }
 8133                        return Response.FromValue(value, message.Response);
 134                    }
 135                case 204:
 0136                    return Response.FromValue<PolicyAssignment>(null, message.Response);
 137                default:
 0138                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 139            }
 8140        }
 141
 142        internal Core.HttpMessage CreateCreateRequest(string scope, string policyAssignmentName, PolicyAssignment parame
 143        {
 32144            var message = _pipeline.CreateMessage();
 32145            var request = message.Request;
 32146            request.Method = RequestMethod.Put;
 32147            var uri = new RawRequestUriBuilder();
 32148            uri.Reset(endpoint);
 32149            uri.AppendPath("/", false);
 32150            uri.AppendPath(scope, false);
 32151            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments/", false);
 32152            uri.AppendPath(policyAssignmentName, true);
 32153            uri.AppendQuery("api-version", "2019-09-01", true);
 32154            request.Uri = uri;
 32155            request.Headers.Add("Content-Type", "application/json");
 32156            var content = new Utf8JsonRequestContent();
 32157            content.JsonWriter.WriteObjectValue(parameters);
 32158            request.Content = content;
 32159            return message;
 160        }
 161
 162        /// <summary>  This operation creates or updates a policy assignment with the given scope and name. Policy assig
 163        /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: &apos;/
 164        /// <param name="policyAssignmentName"> The name of the policy assignment. </param>
 165        /// <param name="parameters"> Parameters for the policy assignment. </param>
 166        /// <param name="cancellationToken"> The cancellation token to use. </param>
 167        public async Task<Response<PolicyAssignment>> CreateAsync(string scope, string policyAssignmentName, PolicyAssig
 168        {
 16169            if (scope == null)
 170            {
 0171                throw new ArgumentNullException(nameof(scope));
 172            }
 16173            if (policyAssignmentName == null)
 174            {
 0175                throw new ArgumentNullException(nameof(policyAssignmentName));
 176            }
 16177            if (parameters == null)
 178            {
 0179                throw new ArgumentNullException(nameof(parameters));
 180            }
 181
 16182            using var message = CreateCreateRequest(scope, policyAssignmentName, parameters);
 16183            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 16184            switch (message.Response.Status)
 185            {
 186                case 201:
 187                    {
 10188                        PolicyAssignment value = default;
 10189                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 10190                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 191                        {
 0192                            value = null;
 193                        }
 194                        else
 195                        {
 10196                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 197                        }
 10198                        return Response.FromValue(value, message.Response);
 199                    }
 200                default:
 6201                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 202            }
 10203        }
 204
 205        /// <summary>  This operation creates or updates a policy assignment with the given scope and name. Policy assig
 206        /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: &apos;/
 207        /// <param name="policyAssignmentName"> The name of the policy assignment. </param>
 208        /// <param name="parameters"> Parameters for the policy assignment. </param>
 209        /// <param name="cancellationToken"> The cancellation token to use. </param>
 210        public Response<PolicyAssignment> Create(string scope, string policyAssignmentName, PolicyAssignment parameters,
 211        {
 16212            if (scope == null)
 213            {
 0214                throw new ArgumentNullException(nameof(scope));
 215            }
 16216            if (policyAssignmentName == null)
 217            {
 0218                throw new ArgumentNullException(nameof(policyAssignmentName));
 219            }
 16220            if (parameters == null)
 221            {
 0222                throw new ArgumentNullException(nameof(parameters));
 223            }
 224
 16225            using var message = CreateCreateRequest(scope, policyAssignmentName, parameters);
 16226            _pipeline.Send(message, cancellationToken);
 16227            switch (message.Response.Status)
 228            {
 229                case 201:
 230                    {
 10231                        PolicyAssignment value = default;
 10232                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 10233                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 234                        {
 0235                            value = null;
 236                        }
 237                        else
 238                        {
 10239                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 240                        }
 10241                        return Response.FromValue(value, message.Response);
 242                    }
 243                default:
 6244                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 245            }
 10246        }
 247
 248        internal Core.HttpMessage CreateGetRequest(string scope, string policyAssignmentName)
 249        {
 20250            var message = _pipeline.CreateMessage();
 20251            var request = message.Request;
 20252            request.Method = RequestMethod.Get;
 20253            var uri = new RawRequestUriBuilder();
 20254            uri.Reset(endpoint);
 20255            uri.AppendPath("/", false);
 20256            uri.AppendPath(scope, false);
 20257            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments/", false);
 20258            uri.AppendPath(policyAssignmentName, true);
 20259            uri.AppendQuery("api-version", "2019-09-01", true);
 20260            request.Uri = uri;
 20261            return message;
 262        }
 263
 264        /// <summary> This operation retrieves a single policy assignment, given its name and the scope it was created a
 265        /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: &apos;/
 266        /// <param name="policyAssignmentName"> The name of the policy assignment to get. </param>
 267        /// <param name="cancellationToken"> The cancellation token to use. </param>
 268        public async Task<Response<PolicyAssignment>> GetAsync(string scope, string policyAssignmentName, CancellationTo
 269        {
 10270            if (scope == null)
 271            {
 0272                throw new ArgumentNullException(nameof(scope));
 273            }
 10274            if (policyAssignmentName == null)
 275            {
 0276                throw new ArgumentNullException(nameof(policyAssignmentName));
 277            }
 278
 10279            using var message = CreateGetRequest(scope, policyAssignmentName);
 10280            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 10281            switch (message.Response.Status)
 282            {
 283                case 200:
 284                    {
 6285                        PolicyAssignment value = default;
 6286                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6287                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 288                        {
 0289                            value = null;
 290                        }
 291                        else
 292                        {
 6293                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 294                        }
 6295                        return Response.FromValue(value, message.Response);
 296                    }
 297                default:
 4298                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 299            }
 6300        }
 301
 302        /// <summary> This operation retrieves a single policy assignment, given its name and the scope it was created a
 303        /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: &apos;/
 304        /// <param name="policyAssignmentName"> The name of the policy assignment to get. </param>
 305        /// <param name="cancellationToken"> The cancellation token to use. </param>
 306        public Response<PolicyAssignment> Get(string scope, string policyAssignmentName, CancellationToken cancellationT
 307        {
 10308            if (scope == null)
 309            {
 0310                throw new ArgumentNullException(nameof(scope));
 311            }
 10312            if (policyAssignmentName == null)
 313            {
 0314                throw new ArgumentNullException(nameof(policyAssignmentName));
 315            }
 316
 10317            using var message = CreateGetRequest(scope, policyAssignmentName);
 10318            _pipeline.Send(message, cancellationToken);
 10319            switch (message.Response.Status)
 320            {
 321                case 200:
 322                    {
 6323                        PolicyAssignment value = default;
 6324                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6325                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 326                        {
 0327                            value = null;
 328                        }
 329                        else
 330                        {
 6331                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 332                        }
 6333                        return Response.FromValue(value, message.Response);
 334                    }
 335                default:
 4336                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 337            }
 6338        }
 339
 340        internal Core.HttpMessage CreateListForResourceGroupRequest(string resourceGroupName, string filter)
 341        {
 4342            var message = _pipeline.CreateMessage();
 4343            var request = message.Request;
 4344            request.Method = RequestMethod.Get;
 4345            var uri = new RawRequestUriBuilder();
 4346            uri.Reset(endpoint);
 4347            uri.AppendPath("/subscriptions/", false);
 4348            uri.AppendPath(subscriptionId, true);
 4349            uri.AppendPath("/resourceGroups/", false);
 4350            uri.AppendPath(resourceGroupName, true);
 4351            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments", false);
 4352            if (filter != null)
 353            {
 0354                uri.AppendQuery("$filter", filter, false);
 355            }
 4356            uri.AppendQuery("api-version", "2019-09-01", true);
 4357            request.Uri = uri;
 4358            return message;
 359        }
 360
 361        /// <summary> This operation retrieves the list of all policy assignments associated with the given resource gro
 362        /// <param name="resourceGroupName"> The name of the resource group that contains policy assignments. </param>
 363        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 364        /// <param name="cancellationToken"> The cancellation token to use. </param>
 365        public async Task<Response<PolicyAssignmentListResult>> ListForResourceGroupAsync(string resourceGroupName, stri
 366        {
 2367            if (resourceGroupName == null)
 368            {
 0369                throw new ArgumentNullException(nameof(resourceGroupName));
 370            }
 371
 2372            using var message = CreateListForResourceGroupRequest(resourceGroupName, filter);
 2373            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2374            switch (message.Response.Status)
 375            {
 376                case 200:
 377                    {
 2378                        PolicyAssignmentListResult value = default;
 2379                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2380                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 381                        {
 0382                            value = null;
 383                        }
 384                        else
 385                        {
 2386                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 387                        }
 2388                        return Response.FromValue(value, message.Response);
 389                    }
 390                default:
 0391                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 392            }
 2393        }
 394
 395        /// <summary> This operation retrieves the list of all policy assignments associated with the given resource gro
 396        /// <param name="resourceGroupName"> The name of the resource group that contains policy assignments. </param>
 397        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 398        /// <param name="cancellationToken"> The cancellation token to use. </param>
 399        public Response<PolicyAssignmentListResult> ListForResourceGroup(string resourceGroupName, string filter = null,
 400        {
 2401            if (resourceGroupName == null)
 402            {
 0403                throw new ArgumentNullException(nameof(resourceGroupName));
 404            }
 405
 2406            using var message = CreateListForResourceGroupRequest(resourceGroupName, filter);
 2407            _pipeline.Send(message, cancellationToken);
 2408            switch (message.Response.Status)
 409            {
 410                case 200:
 411                    {
 2412                        PolicyAssignmentListResult value = default;
 2413                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2414                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 415                        {
 0416                            value = null;
 417                        }
 418                        else
 419                        {
 2420                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 421                        }
 2422                        return Response.FromValue(value, message.Response);
 423                    }
 424                default:
 0425                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 426            }
 2427        }
 428
 429        internal Core.HttpMessage CreateListForResourceRequest(string resourceGroupName, string resourceProviderNamespac
 430        {
 4431            var message = _pipeline.CreateMessage();
 4432            var request = message.Request;
 4433            request.Method = RequestMethod.Get;
 4434            var uri = new RawRequestUriBuilder();
 4435            uri.Reset(endpoint);
 4436            uri.AppendPath("/subscriptions/", false);
 4437            uri.AppendPath(subscriptionId, true);
 4438            uri.AppendPath("/resourcegroups/", false);
 4439            uri.AppendPath(resourceGroupName, true);
 4440            uri.AppendPath("/providers/", false);
 4441            uri.AppendPath(resourceProviderNamespace, true);
 4442            uri.AppendPath("/", false);
 4443            uri.AppendPath(parentResourcePath, false);
 4444            uri.AppendPath("/", false);
 4445            uri.AppendPath(resourceType, false);
 4446            uri.AppendPath("/", false);
 4447            uri.AppendPath(resourceName, true);
 4448            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments", false);
 4449            if (filter != null)
 450            {
 0451                uri.AppendQuery("$filter", filter, true);
 452            }
 4453            uri.AppendQuery("api-version", "2019-09-01", true);
 4454            request.Uri = uri;
 4455            return message;
 456        }
 457
 458        /// <summary> This operation retrieves the list of all policy assignments associated with the specified resource
 459        /// <param name="resourceGroupName"> The name of the resource group containing the resource. </param>
 460        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. For example, the namespace 
 461        /// <param name="parentResourcePath"> The parent resource path. Use empty string if there is none. </param>
 462        /// <param name="resourceType"> The resource type name. For example the type name of a web app is &apos;sites&ap
 463        /// <param name="resourceName"> The name of the resource. </param>
 464        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 465        /// <param name="cancellationToken"> The cancellation token to use. </param>
 466        public async Task<Response<PolicyAssignmentListResult>> ListForResourceAsync(string resourceGroupName, string re
 467        {
 2468            if (resourceGroupName == null)
 469            {
 0470                throw new ArgumentNullException(nameof(resourceGroupName));
 471            }
 2472            if (resourceProviderNamespace == null)
 473            {
 0474                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 475            }
 2476            if (parentResourcePath == null)
 477            {
 0478                throw new ArgumentNullException(nameof(parentResourcePath));
 479            }
 2480            if (resourceType == null)
 481            {
 0482                throw new ArgumentNullException(nameof(resourceType));
 483            }
 2484            if (resourceName == null)
 485            {
 0486                throw new ArgumentNullException(nameof(resourceName));
 487            }
 488
 2489            using var message = CreateListForResourceRequest(resourceGroupName, resourceProviderNamespace, parentResourc
 2490            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2491            switch (message.Response.Status)
 492            {
 493                case 200:
 494                    {
 2495                        PolicyAssignmentListResult value = default;
 2496                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2497                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 498                        {
 0499                            value = null;
 500                        }
 501                        else
 502                        {
 2503                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 504                        }
 2505                        return Response.FromValue(value, message.Response);
 506                    }
 507                default:
 0508                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 509            }
 2510        }
 511
 512        /// <summary> This operation retrieves the list of all policy assignments associated with the specified resource
 513        /// <param name="resourceGroupName"> The name of the resource group containing the resource. </param>
 514        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. For example, the namespace 
 515        /// <param name="parentResourcePath"> The parent resource path. Use empty string if there is none. </param>
 516        /// <param name="resourceType"> The resource type name. For example the type name of a web app is &apos;sites&ap
 517        /// <param name="resourceName"> The name of the resource. </param>
 518        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 519        /// <param name="cancellationToken"> The cancellation token to use. </param>
 520        public Response<PolicyAssignmentListResult> ListForResource(string resourceGroupName, string resourceProviderNam
 521        {
 2522            if (resourceGroupName == null)
 523            {
 0524                throw new ArgumentNullException(nameof(resourceGroupName));
 525            }
 2526            if (resourceProviderNamespace == null)
 527            {
 0528                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 529            }
 2530            if (parentResourcePath == null)
 531            {
 0532                throw new ArgumentNullException(nameof(parentResourcePath));
 533            }
 2534            if (resourceType == null)
 535            {
 0536                throw new ArgumentNullException(nameof(resourceType));
 537            }
 2538            if (resourceName == null)
 539            {
 0540                throw new ArgumentNullException(nameof(resourceName));
 541            }
 542
 2543            using var message = CreateListForResourceRequest(resourceGroupName, resourceProviderNamespace, parentResourc
 2544            _pipeline.Send(message, cancellationToken);
 2545            switch (message.Response.Status)
 546            {
 547                case 200:
 548                    {
 2549                        PolicyAssignmentListResult value = default;
 2550                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2551                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 552                        {
 0553                            value = null;
 554                        }
 555                        else
 556                        {
 2557                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 558                        }
 2559                        return Response.FromValue(value, message.Response);
 560                    }
 561                default:
 0562                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 563            }
 2564        }
 565
 566        internal Core.HttpMessage CreateListForManagementGroupRequest(string managementGroupId, string filter)
 567        {
 0568            var message = _pipeline.CreateMessage();
 0569            var request = message.Request;
 0570            request.Method = RequestMethod.Get;
 0571            var uri = new RawRequestUriBuilder();
 0572            uri.Reset(endpoint);
 0573            uri.AppendPath("/providers/Microsoft.Management/managementgroups/", false);
 0574            uri.AppendPath(managementGroupId, true);
 0575            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments", false);
 0576            uri.AppendQuery("$filter", filter, false);
 0577            uri.AppendQuery("api-version", "2019-09-01", true);
 0578            request.Uri = uri;
 0579            return message;
 580        }
 581
 582        /// <summary> This operation retrieves the list of all policy assignments applicable to the management group tha
 583        /// <param name="managementGroupId"> The ID of the management group. </param>
 584        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 585        /// <param name="cancellationToken"> The cancellation token to use. </param>
 586        public async Task<Response<PolicyAssignmentListResult>> ListForManagementGroupAsync(string managementGroupId, st
 587        {
 0588            if (managementGroupId == null)
 589            {
 0590                throw new ArgumentNullException(nameof(managementGroupId));
 591            }
 0592            if (filter == null)
 593            {
 0594                throw new ArgumentNullException(nameof(filter));
 595            }
 596
 0597            using var message = CreateListForManagementGroupRequest(managementGroupId, filter);
 0598            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0599            switch (message.Response.Status)
 600            {
 601                case 200:
 602                    {
 0603                        PolicyAssignmentListResult value = default;
 0604                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0605                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 606                        {
 0607                            value = null;
 608                        }
 609                        else
 610                        {
 0611                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 612                        }
 0613                        return Response.FromValue(value, message.Response);
 614                    }
 615                default:
 0616                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 617            }
 0618        }
 619
 620        /// <summary> This operation retrieves the list of all policy assignments applicable to the management group tha
 621        /// <param name="managementGroupId"> The ID of the management group. </param>
 622        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 623        /// <param name="cancellationToken"> The cancellation token to use. </param>
 624        public Response<PolicyAssignmentListResult> ListForManagementGroup(string managementGroupId, string filter, Canc
 625        {
 0626            if (managementGroupId == null)
 627            {
 0628                throw new ArgumentNullException(nameof(managementGroupId));
 629            }
 0630            if (filter == null)
 631            {
 0632                throw new ArgumentNullException(nameof(filter));
 633            }
 634
 0635            using var message = CreateListForManagementGroupRequest(managementGroupId, filter);
 0636            _pipeline.Send(message, cancellationToken);
 0637            switch (message.Response.Status)
 638            {
 639                case 200:
 640                    {
 0641                        PolicyAssignmentListResult value = default;
 0642                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0643                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 644                        {
 0645                            value = null;
 646                        }
 647                        else
 648                        {
 0649                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 650                        }
 0651                        return Response.FromValue(value, message.Response);
 652                    }
 653                default:
 0654                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 655            }
 0656        }
 657
 658        internal Core.HttpMessage CreateListRequest(string filter)
 659        {
 12660            var message = _pipeline.CreateMessage();
 12661            var request = message.Request;
 12662            request.Method = RequestMethod.Get;
 12663            var uri = new RawRequestUriBuilder();
 12664            uri.Reset(endpoint);
 12665            uri.AppendPath("/subscriptions/", false);
 12666            uri.AppendPath(subscriptionId, true);
 12667            uri.AppendPath("/providers/Microsoft.Authorization/policyAssignments", false);
 12668            if (filter != null)
 669            {
 0670                uri.AppendQuery("$filter", filter, true);
 671            }
 12672            uri.AppendQuery("api-version", "2019-09-01", true);
 12673            request.Uri = uri;
 12674            return message;
 675        }
 676
 677        /// <summary> This operation retrieves the list of all policy assignments associated with the given subscription
 678        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 679        /// <param name="cancellationToken"> The cancellation token to use. </param>
 680        public async Task<Response<PolicyAssignmentListResult>> ListAsync(string filter = null, CancellationToken cancel
 681        {
 6682            using var message = CreateListRequest(filter);
 6683            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6684            switch (message.Response.Status)
 685            {
 686                case 200:
 687                    {
 6688                        PolicyAssignmentListResult value = default;
 6689                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6690                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 691                        {
 0692                            value = null;
 693                        }
 694                        else
 695                        {
 6696                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 697                        }
 6698                        return Response.FromValue(value, message.Response);
 699                    }
 700                default:
 0701                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 702            }
 6703        }
 704
 705        /// <summary> This operation retrieves the list of all policy assignments associated with the given subscription
 706        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 707        /// <param name="cancellationToken"> The cancellation token to use. </param>
 708        public Response<PolicyAssignmentListResult> List(string filter = null, CancellationToken cancellationToken = def
 709        {
 6710            using var message = CreateListRequest(filter);
 6711            _pipeline.Send(message, cancellationToken);
 6712            switch (message.Response.Status)
 713            {
 714                case 200:
 715                    {
 6716                        PolicyAssignmentListResult value = default;
 6717                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6718                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 719                        {
 0720                            value = null;
 721                        }
 722                        else
 723                        {
 6724                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 725                        }
 6726                        return Response.FromValue(value, message.Response);
 727                    }
 728                default:
 0729                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 730            }
 6731        }
 732
 733        internal Core.HttpMessage CreateDeleteByIdRequest(string policyAssignmentId)
 734        {
 0735            var message = _pipeline.CreateMessage();
 0736            var request = message.Request;
 0737            request.Method = RequestMethod.Delete;
 0738            var uri = new RawRequestUriBuilder();
 0739            uri.Reset(endpoint);
 0740            uri.AppendPath("/", false);
 0741            uri.AppendPath(policyAssignmentId, false);
 0742            uri.AppendQuery("api-version", "2019-09-01", true);
 0743            request.Uri = uri;
 0744            return message;
 745        }
 746
 747        /// <summary> This operation deletes the policy with the given ID. Policy assignment IDs have this format: &apos
 748        /// <param name="policyAssignmentId"> The ID of the policy assignment to delete. Use the format &apos;{scope}/pr
 749        /// <param name="cancellationToken"> The cancellation token to use. </param>
 750        public async Task<Response<PolicyAssignment>> DeleteByIdAsync(string policyAssignmentId, CancellationToken cance
 751        {
 0752            if (policyAssignmentId == null)
 753            {
 0754                throw new ArgumentNullException(nameof(policyAssignmentId));
 755            }
 756
 0757            using var message = CreateDeleteByIdRequest(policyAssignmentId);
 0758            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0759            switch (message.Response.Status)
 760            {
 761                case 200:
 762                    {
 0763                        PolicyAssignment value = default;
 0764                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0765                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 766                        {
 0767                            value = null;
 768                        }
 769                        else
 770                        {
 0771                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 772                        }
 0773                        return Response.FromValue(value, message.Response);
 774                    }
 775                case 204:
 0776                    return Response.FromValue<PolicyAssignment>(null, message.Response);
 777                default:
 0778                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 779            }
 0780        }
 781
 782        /// <summary> This operation deletes the policy with the given ID. Policy assignment IDs have this format: &apos
 783        /// <param name="policyAssignmentId"> The ID of the policy assignment to delete. Use the format &apos;{scope}/pr
 784        /// <param name="cancellationToken"> The cancellation token to use. </param>
 785        public Response<PolicyAssignment> DeleteById(string policyAssignmentId, CancellationToken cancellationToken = de
 786        {
 0787            if (policyAssignmentId == null)
 788            {
 0789                throw new ArgumentNullException(nameof(policyAssignmentId));
 790            }
 791
 0792            using var message = CreateDeleteByIdRequest(policyAssignmentId);
 0793            _pipeline.Send(message, cancellationToken);
 0794            switch (message.Response.Status)
 795            {
 796                case 200:
 797                    {
 0798                        PolicyAssignment value = default;
 0799                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0800                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 801                        {
 0802                            value = null;
 803                        }
 804                        else
 805                        {
 0806                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 807                        }
 0808                        return Response.FromValue(value, message.Response);
 809                    }
 810                case 204:
 0811                    return Response.FromValue<PolicyAssignment>(null, message.Response);
 812                default:
 0813                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 814            }
 0815        }
 816
 817        internal Core.HttpMessage CreateCreateByIdRequest(string policyAssignmentId, PolicyAssignment parameters)
 818        {
 0819            var message = _pipeline.CreateMessage();
 0820            var request = message.Request;
 0821            request.Method = RequestMethod.Put;
 0822            var uri = new RawRequestUriBuilder();
 0823            uri.Reset(endpoint);
 0824            uri.AppendPath("/", false);
 0825            uri.AppendPath(policyAssignmentId, false);
 0826            uri.AppendQuery("api-version", "2019-09-01", true);
 0827            request.Uri = uri;
 0828            request.Headers.Add("Content-Type", "application/json");
 0829            var content = new Utf8JsonRequestContent();
 0830            content.JsonWriter.WriteObjectValue(parameters);
 0831            request.Content = content;
 0832            return message;
 833        }
 834
 835        /// <summary> This operation creates or updates the policy assignment with the given ID. Policy assignments made
 836        /// <param name="policyAssignmentId"> The ID of the policy assignment to create. Use the format &apos;{scope}/pr
 837        /// <param name="parameters"> Parameters for policy assignment. </param>
 838        /// <param name="cancellationToken"> The cancellation token to use. </param>
 839        public async Task<Response<PolicyAssignment>> CreateByIdAsync(string policyAssignmentId, PolicyAssignment parame
 840        {
 0841            if (policyAssignmentId == null)
 842            {
 0843                throw new ArgumentNullException(nameof(policyAssignmentId));
 844            }
 0845            if (parameters == null)
 846            {
 0847                throw new ArgumentNullException(nameof(parameters));
 848            }
 849
 0850            using var message = CreateCreateByIdRequest(policyAssignmentId, parameters);
 0851            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0852            switch (message.Response.Status)
 853            {
 854                case 201:
 855                    {
 0856                        PolicyAssignment value = default;
 0857                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0858                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 859                        {
 0860                            value = null;
 861                        }
 862                        else
 863                        {
 0864                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 865                        }
 0866                        return Response.FromValue(value, message.Response);
 867                    }
 868                default:
 0869                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 870            }
 0871        }
 872
 873        /// <summary> This operation creates or updates the policy assignment with the given ID. Policy assignments made
 874        /// <param name="policyAssignmentId"> The ID of the policy assignment to create. Use the format &apos;{scope}/pr
 875        /// <param name="parameters"> Parameters for policy assignment. </param>
 876        /// <param name="cancellationToken"> The cancellation token to use. </param>
 877        public Response<PolicyAssignment> CreateById(string policyAssignmentId, PolicyAssignment parameters, Cancellatio
 878        {
 0879            if (policyAssignmentId == null)
 880            {
 0881                throw new ArgumentNullException(nameof(policyAssignmentId));
 882            }
 0883            if (parameters == null)
 884            {
 0885                throw new ArgumentNullException(nameof(parameters));
 886            }
 887
 0888            using var message = CreateCreateByIdRequest(policyAssignmentId, parameters);
 0889            _pipeline.Send(message, cancellationToken);
 0890            switch (message.Response.Status)
 891            {
 892                case 201:
 893                    {
 0894                        PolicyAssignment value = default;
 0895                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0896                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 897                        {
 0898                            value = null;
 899                        }
 900                        else
 901                        {
 0902                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 903                        }
 0904                        return Response.FromValue(value, message.Response);
 905                    }
 906                default:
 0907                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 908            }
 0909        }
 910
 911        internal Core.HttpMessage CreateGetByIdRequest(string policyAssignmentId)
 912        {
 8913            var message = _pipeline.CreateMessage();
 8914            var request = message.Request;
 8915            request.Method = RequestMethod.Get;
 8916            var uri = new RawRequestUriBuilder();
 8917            uri.Reset(endpoint);
 8918            uri.AppendPath("/", false);
 8919            uri.AppendPath(policyAssignmentId, false);
 8920            uri.AppendQuery("api-version", "2019-09-01", true);
 8921            request.Uri = uri;
 8922            return message;
 923        }
 924
 925        /// <summary> The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this f
 926        /// <param name="policyAssignmentId"> The ID of the policy assignment to get. Use the format &apos;{scope}/provi
 927        /// <param name="cancellationToken"> The cancellation token to use. </param>
 928        public async Task<Response<PolicyAssignment>> GetByIdAsync(string policyAssignmentId, CancellationToken cancella
 929        {
 4930            if (policyAssignmentId == null)
 931            {
 0932                throw new ArgumentNullException(nameof(policyAssignmentId));
 933            }
 934
 4935            using var message = CreateGetByIdRequest(policyAssignmentId);
 4936            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4937            switch (message.Response.Status)
 938            {
 939                case 200:
 940                    {
 4941                        PolicyAssignment value = default;
 4942                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4943                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 944                        {
 0945                            value = null;
 946                        }
 947                        else
 948                        {
 4949                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 950                        }
 4951                        return Response.FromValue(value, message.Response);
 952                    }
 953                default:
 0954                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 955            }
 4956        }
 957
 958        /// <summary> The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this f
 959        /// <param name="policyAssignmentId"> The ID of the policy assignment to get. Use the format &apos;{scope}/provi
 960        /// <param name="cancellationToken"> The cancellation token to use. </param>
 961        public Response<PolicyAssignment> GetById(string policyAssignmentId, CancellationToken cancellationToken = defau
 962        {
 4963            if (policyAssignmentId == null)
 964            {
 0965                throw new ArgumentNullException(nameof(policyAssignmentId));
 966            }
 967
 4968            using var message = CreateGetByIdRequest(policyAssignmentId);
 4969            _pipeline.Send(message, cancellationToken);
 4970            switch (message.Response.Status)
 971            {
 972                case 200:
 973                    {
 4974                        PolicyAssignment value = default;
 4975                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4976                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 977                        {
 0978                            value = null;
 979                        }
 980                        else
 981                        {
 4982                            value = PolicyAssignment.DeserializePolicyAssignment(document.RootElement);
 983                        }
 4984                        return Response.FromValue(value, message.Response);
 985                    }
 986                default:
 0987                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 988            }
 4989        }
 990
 991        internal Core.HttpMessage CreateListForResourceGroupNextPageRequest(string nextLink, string resourceGroupName, s
 992        {
 0993            var message = _pipeline.CreateMessage();
 0994            var request = message.Request;
 0995            request.Method = RequestMethod.Get;
 0996            var uri = new RawRequestUriBuilder();
 0997            uri.Reset(endpoint);
 0998            uri.AppendRawNextLink(nextLink, false);
 0999            request.Uri = uri;
 01000            return message;
 1001        }
 1002
 1003        /// <summary> This operation retrieves the list of all policy assignments associated with the given resource gro
 1004        /// <param name="nextLink"> The URL to the next page of results. </param>
 1005        /// <param name="resourceGroupName"> The name of the resource group that contains policy assignments. </param>
 1006        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1007        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1008        public async Task<Response<PolicyAssignmentListResult>> ListForResourceGroupNextPageAsync(string nextLink, strin
 1009        {
 01010            if (nextLink == null)
 1011            {
 01012                throw new ArgumentNullException(nameof(nextLink));
 1013            }
 01014            if (resourceGroupName == null)
 1015            {
 01016                throw new ArgumentNullException(nameof(resourceGroupName));
 1017            }
 1018
 01019            using var message = CreateListForResourceGroupNextPageRequest(nextLink, resourceGroupName, filter);
 01020            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01021            switch (message.Response.Status)
 1022            {
 1023                case 200:
 1024                    {
 01025                        PolicyAssignmentListResult value = default;
 01026                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01027                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1028                        {
 01029                            value = null;
 1030                        }
 1031                        else
 1032                        {
 01033                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1034                        }
 01035                        return Response.FromValue(value, message.Response);
 1036                    }
 1037                default:
 01038                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1039            }
 01040        }
 1041
 1042        /// <summary> This operation retrieves the list of all policy assignments associated with the given resource gro
 1043        /// <param name="nextLink"> The URL to the next page of results. </param>
 1044        /// <param name="resourceGroupName"> The name of the resource group that contains policy assignments. </param>
 1045        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1046        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1047        public Response<PolicyAssignmentListResult> ListForResourceGroupNextPage(string nextLink, string resourceGroupNa
 1048        {
 01049            if (nextLink == null)
 1050            {
 01051                throw new ArgumentNullException(nameof(nextLink));
 1052            }
 01053            if (resourceGroupName == null)
 1054            {
 01055                throw new ArgumentNullException(nameof(resourceGroupName));
 1056            }
 1057
 01058            using var message = CreateListForResourceGroupNextPageRequest(nextLink, resourceGroupName, filter);
 01059            _pipeline.Send(message, cancellationToken);
 01060            switch (message.Response.Status)
 1061            {
 1062                case 200:
 1063                    {
 01064                        PolicyAssignmentListResult value = default;
 01065                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01066                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1067                        {
 01068                            value = null;
 1069                        }
 1070                        else
 1071                        {
 01072                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1073                        }
 01074                        return Response.FromValue(value, message.Response);
 1075                    }
 1076                default:
 01077                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1078            }
 01079        }
 1080
 1081        internal Core.HttpMessage CreateListForResourceNextPageRequest(string nextLink, string resourceGroupName, string
 1082        {
 01083            var message = _pipeline.CreateMessage();
 01084            var request = message.Request;
 01085            request.Method = RequestMethod.Get;
 01086            var uri = new RawRequestUriBuilder();
 01087            uri.Reset(endpoint);
 01088            uri.AppendRawNextLink(nextLink, false);
 01089            request.Uri = uri;
 01090            return message;
 1091        }
 1092
 1093        /// <summary> This operation retrieves the list of all policy assignments associated with the specified resource
 1094        /// <param name="nextLink"> The URL to the next page of results. </param>
 1095        /// <param name="resourceGroupName"> The name of the resource group containing the resource. </param>
 1096        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. For example, the namespace 
 1097        /// <param name="parentResourcePath"> The parent resource path. Use empty string if there is none. </param>
 1098        /// <param name="resourceType"> The resource type name. For example the type name of a web app is &apos;sites&ap
 1099        /// <param name="resourceName"> The name of the resource. </param>
 1100        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1101        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1102        public async Task<Response<PolicyAssignmentListResult>> ListForResourceNextPageAsync(string nextLink, string res
 1103        {
 01104            if (nextLink == null)
 1105            {
 01106                throw new ArgumentNullException(nameof(nextLink));
 1107            }
 01108            if (resourceGroupName == null)
 1109            {
 01110                throw new ArgumentNullException(nameof(resourceGroupName));
 1111            }
 01112            if (resourceProviderNamespace == null)
 1113            {
 01114                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 1115            }
 01116            if (parentResourcePath == null)
 1117            {
 01118                throw new ArgumentNullException(nameof(parentResourcePath));
 1119            }
 01120            if (resourceType == null)
 1121            {
 01122                throw new ArgumentNullException(nameof(resourceType));
 1123            }
 01124            if (resourceName == null)
 1125            {
 01126                throw new ArgumentNullException(nameof(resourceName));
 1127            }
 1128
 01129            using var message = CreateListForResourceNextPageRequest(nextLink, resourceGroupName, resourceProviderNamesp
 01130            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01131            switch (message.Response.Status)
 1132            {
 1133                case 200:
 1134                    {
 01135                        PolicyAssignmentListResult value = default;
 01136                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01137                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1138                        {
 01139                            value = null;
 1140                        }
 1141                        else
 1142                        {
 01143                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1144                        }
 01145                        return Response.FromValue(value, message.Response);
 1146                    }
 1147                default:
 01148                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1149            }
 01150        }
 1151
 1152        /// <summary> This operation retrieves the list of all policy assignments associated with the specified resource
 1153        /// <param name="nextLink"> The URL to the next page of results. </param>
 1154        /// <param name="resourceGroupName"> The name of the resource group containing the resource. </param>
 1155        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. For example, the namespace 
 1156        /// <param name="parentResourcePath"> The parent resource path. Use empty string if there is none. </param>
 1157        /// <param name="resourceType"> The resource type name. For example the type name of a web app is &apos;sites&ap
 1158        /// <param name="resourceName"> The name of the resource. </param>
 1159        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1160        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1161        public Response<PolicyAssignmentListResult> ListForResourceNextPage(string nextLink, string resourceGroupName, s
 1162        {
 01163            if (nextLink == null)
 1164            {
 01165                throw new ArgumentNullException(nameof(nextLink));
 1166            }
 01167            if (resourceGroupName == null)
 1168            {
 01169                throw new ArgumentNullException(nameof(resourceGroupName));
 1170            }
 01171            if (resourceProviderNamespace == null)
 1172            {
 01173                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 1174            }
 01175            if (parentResourcePath == null)
 1176            {
 01177                throw new ArgumentNullException(nameof(parentResourcePath));
 1178            }
 01179            if (resourceType == null)
 1180            {
 01181                throw new ArgumentNullException(nameof(resourceType));
 1182            }
 01183            if (resourceName == null)
 1184            {
 01185                throw new ArgumentNullException(nameof(resourceName));
 1186            }
 1187
 01188            using var message = CreateListForResourceNextPageRequest(nextLink, resourceGroupName, resourceProviderNamesp
 01189            _pipeline.Send(message, cancellationToken);
 01190            switch (message.Response.Status)
 1191            {
 1192                case 200:
 1193                    {
 01194                        PolicyAssignmentListResult value = default;
 01195                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01196                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1197                        {
 01198                            value = null;
 1199                        }
 1200                        else
 1201                        {
 01202                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1203                        }
 01204                        return Response.FromValue(value, message.Response);
 1205                    }
 1206                default:
 01207                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1208            }
 01209        }
 1210
 1211        internal Core.HttpMessage CreateListForManagementGroupNextPageRequest(string nextLink, string managementGroupId,
 1212        {
 01213            var message = _pipeline.CreateMessage();
 01214            var request = message.Request;
 01215            request.Method = RequestMethod.Get;
 01216            var uri = new RawRequestUriBuilder();
 01217            uri.Reset(endpoint);
 01218            uri.AppendRawNextLink(nextLink, false);
 01219            request.Uri = uri;
 01220            return message;
 1221        }
 1222
 1223        /// <summary> This operation retrieves the list of all policy assignments applicable to the management group tha
 1224        /// <param name="nextLink"> The URL to the next page of results. </param>
 1225        /// <param name="managementGroupId"> The ID of the management group. </param>
 1226        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1227        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1228        public async Task<Response<PolicyAssignmentListResult>> ListForManagementGroupNextPageAsync(string nextLink, str
 1229        {
 01230            if (nextLink == null)
 1231            {
 01232                throw new ArgumentNullException(nameof(nextLink));
 1233            }
 01234            if (managementGroupId == null)
 1235            {
 01236                throw new ArgumentNullException(nameof(managementGroupId));
 1237            }
 01238            if (filter == null)
 1239            {
 01240                throw new ArgumentNullException(nameof(filter));
 1241            }
 1242
 01243            using var message = CreateListForManagementGroupNextPageRequest(nextLink, managementGroupId, filter);
 01244            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01245            switch (message.Response.Status)
 1246            {
 1247                case 200:
 1248                    {
 01249                        PolicyAssignmentListResult value = default;
 01250                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01251                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1252                        {
 01253                            value = null;
 1254                        }
 1255                        else
 1256                        {
 01257                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1258                        }
 01259                        return Response.FromValue(value, message.Response);
 1260                    }
 1261                default:
 01262                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1263            }
 01264        }
 1265
 1266        /// <summary> This operation retrieves the list of all policy assignments applicable to the management group tha
 1267        /// <param name="nextLink"> The URL to the next page of results. </param>
 1268        /// <param name="managementGroupId"> The ID of the management group. </param>
 1269        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1270        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1271        public Response<PolicyAssignmentListResult> ListForManagementGroupNextPage(string nextLink, string managementGro
 1272        {
 01273            if (nextLink == null)
 1274            {
 01275                throw new ArgumentNullException(nameof(nextLink));
 1276            }
 01277            if (managementGroupId == null)
 1278            {
 01279                throw new ArgumentNullException(nameof(managementGroupId));
 1280            }
 01281            if (filter == null)
 1282            {
 01283                throw new ArgumentNullException(nameof(filter));
 1284            }
 1285
 01286            using var message = CreateListForManagementGroupNextPageRequest(nextLink, managementGroupId, filter);
 01287            _pipeline.Send(message, cancellationToken);
 01288            switch (message.Response.Status)
 1289            {
 1290                case 200:
 1291                    {
 01292                        PolicyAssignmentListResult value = default;
 01293                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01294                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1295                        {
 01296                            value = null;
 1297                        }
 1298                        else
 1299                        {
 01300                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1301                        }
 01302                        return Response.FromValue(value, message.Response);
 1303                    }
 1304                default:
 01305                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1306            }
 01307        }
 1308
 1309        internal Core.HttpMessage CreateListNextPageRequest(string nextLink, string filter)
 1310        {
 01311            var message = _pipeline.CreateMessage();
 01312            var request = message.Request;
 01313            request.Method = RequestMethod.Get;
 01314            var uri = new RawRequestUriBuilder();
 01315            uri.Reset(endpoint);
 01316            uri.AppendRawNextLink(nextLink, false);
 01317            request.Uri = uri;
 01318            return message;
 1319        }
 1320
 1321        /// <summary> This operation retrieves the list of all policy assignments associated with the given subscription
 1322        /// <param name="nextLink"> The URL to the next page of results. </param>
 1323        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1324        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1325        public async Task<Response<PolicyAssignmentListResult>> ListNextPageAsync(string nextLink, string filter = null,
 1326        {
 01327            if (nextLink == null)
 1328            {
 01329                throw new ArgumentNullException(nameof(nextLink));
 1330            }
 1331
 01332            using var message = CreateListNextPageRequest(nextLink, filter);
 01333            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01334            switch (message.Response.Status)
 1335            {
 1336                case 200:
 1337                    {
 01338                        PolicyAssignmentListResult value = default;
 01339                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01340                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1341                        {
 01342                            value = null;
 1343                        }
 1344                        else
 1345                        {
 01346                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1347                        }
 01348                        return Response.FromValue(value, message.Response);
 1349                    }
 1350                default:
 01351                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1352            }
 01353        }
 1354
 1355        /// <summary> This operation retrieves the list of all policy assignments associated with the given subscription
 1356        /// <param name="nextLink"> The URL to the next page of results. </param>
 1357        /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: &apos;atScope()&ap
 1358        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1359        public Response<PolicyAssignmentListResult> ListNextPage(string nextLink, string filter = null, CancellationToke
 1360        {
 01361            if (nextLink == null)
 1362            {
 01363                throw new ArgumentNullException(nameof(nextLink));
 1364            }
 1365
 01366            using var message = CreateListNextPageRequest(nextLink, filter);
 01367            _pipeline.Send(message, cancellationToken);
 01368            switch (message.Response.Status)
 1369            {
 1370                case 200:
 1371                    {
 01372                        PolicyAssignmentListResult value = default;
 01373                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01374                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1375                        {
 01376                            value = null;
 1377                        }
 1378                        else
 1379                        {
 01380                            value = PolicyAssignmentListResult.DeserializePolicyAssignmentListResult(document.RootElemen
 1381                        }
 01382                        return Response.FromValue(value, message.Response);
 1383                    }
 1384                default:
 01385                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1386            }
 01387        }
 1388    }
 1389}