< Summary

Class:Azure.ResourceManager.Resources.PolicySetDefinitionsOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\PolicySetDefinitionsOperations.cs
Covered lines:76
Uncovered lines:136
Coverable lines:212
Total lines:536
Line coverage:35.8% (76 of 212)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
CreateOrUpdateAsync()-100%100%
CreateOrUpdate(...)-100%100%
DeleteAsync()-57.14%100%
Delete(...)-57.14%100%
GetAsync()-100%100%
Get(...)-100%100%
GetBuiltInAsync()-57.14%100%
GetBuiltIn(...)-57.14%100%
CreateOrUpdateAtManagementGroupAsync()-0%100%
CreateOrUpdateAtManagementGroup(...)-0%100%
DeleteAtManagementGroupAsync()-0%100%
DeleteAtManagementGroup(...)-0%100%
GetAtManagementGroupAsync()-0%100%
GetAtManagementGroup(...)-0%100%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
ListAsync(...)-100%100%
List(...)-100%100%
<ListBuiltInAsync()-62.5%100%
<ListBuiltInAsync()-0%100%
ListBuiltInAsync(...)-100%100%
ListBuiltIn(...)-100%100%
ListByManagementGroupAsync(...)-0%0%
<ListByManagementGroupAsync()-0%100%
<ListByManagementGroupAsync()-0%100%
ListByManagementGroup(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\PolicySetDefinitionsOperations.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.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.Resources.Models;
 15
 16namespace Azure.ResourceManager.Resources
 17{
 18    /// <summary> The PolicySetDefinitions service client. </summary>
 19    public partial class PolicySetDefinitionsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 45223        internal PolicySetDefinitionsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of PolicySetDefinitionsOperations for mocking. </summary>
 25625        protected PolicySetDefinitionsOperations()
 26        {
 25627        }
 28        /// <summary> Initializes a new instance of PolicySetDefinitionsOperations. </summary>
 29        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="subscriptionId"> The ID of the target subscription. </param>
 32        /// <param name="endpoint"> server parameter. </param>
 25633        internal PolicySetDefinitionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc
 34        {
 25635            RestClient = new PolicySetDefinitionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 25636            _clientDiagnostics = clientDiagnostics;
 25637            _pipeline = pipeline;
 25638        }
 39
 40        /// <summary> This operation creates or updates a policy set definition in the given subscription with the given
 41        /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param>
 42        /// <param name="parameters"> The policy set definition properties. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<PolicySetDefinition>> CreateOrUpdateAsync(string policySetDefinitionName, Pol
 45        {
 1646            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdate");
 1647            scope.Start();
 48            try
 49            {
 1650                return await RestClient.CreateOrUpdateAsync(policySetDefinitionName, parameters, cancellationToken).Conf
 51            }
 852            catch (Exception e)
 53            {
 854                scope.Failed(e);
 855                throw;
 56            }
 857        }
 58
 59        /// <summary> This operation creates or updates a policy set definition in the given subscription with the given
 60        /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param>
 61        /// <param name="parameters"> The policy set definition properties. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<PolicySetDefinition> CreateOrUpdate(string policySetDefinitionName, PolicySetDefinition 
 64        {
 1665            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdate");
 1666            scope.Start();
 67            try
 68            {
 1669                return RestClient.CreateOrUpdate(policySetDefinitionName, parameters, cancellationToken);
 70            }
 871            catch (Exception e)
 72            {
 873                scope.Failed(e);
 874                throw;
 75            }
 876        }
 77
 78        /// <summary> This operation deletes the policy set definition in the given subscription with the given name. </
 79        /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param>
 80        /// <param name="cancellationToken"> The cancellation token to use. </param>
 81        public virtual async Task<Response> DeleteAsync(string policySetDefinitionName, CancellationToken cancellationTo
 82        {
 9483            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Delete");
 9484            scope.Start();
 85            try
 86            {
 9487                return await RestClient.DeleteAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false);
 88            }
 089            catch (Exception e)
 90            {
 091                scope.Failed(e);
 092                throw;
 93            }
 9494        }
 95
 96        /// <summary> This operation deletes the policy set definition in the given subscription with the given name. </
 97        /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param>
 98        /// <param name="cancellationToken"> The cancellation token to use. </param>
 99        public virtual Response Delete(string policySetDefinitionName, CancellationToken cancellationToken = default)
 100        {
 94101            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Delete");
 94102            scope.Start();
 103            try
 104            {
 94105                return RestClient.Delete(policySetDefinitionName, cancellationToken);
 106            }
 0107            catch (Exception e)
 108            {
 0109                scope.Failed(e);
 0110                throw;
 111            }
 94112        }
 113
 114        /// <summary> This operation retrieves the policy set definition in the given subscription with the given name. 
 115        /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param>
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public virtual async Task<Response<PolicySetDefinition>> GetAsync(string policySetDefinitionName, CancellationTo
 118        {
 14119            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Get");
 14120            scope.Start();
 121            try
 122            {
 14123                return await RestClient.GetAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false);
 124            }
 6125            catch (Exception e)
 126            {
 6127                scope.Failed(e);
 6128                throw;
 129            }
 8130        }
 131
 132        /// <summary> This operation retrieves the policy set definition in the given subscription with the given name. 
 133        /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param>
 134        /// <param name="cancellationToken"> The cancellation token to use. </param>
 135        public virtual Response<PolicySetDefinition> Get(string policySetDefinitionName, CancellationToken cancellationT
 136        {
 14137            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Get");
 14138            scope.Start();
 139            try
 140            {
 14141                return RestClient.Get(policySetDefinitionName, cancellationToken);
 142            }
 6143            catch (Exception e)
 144            {
 6145                scope.Failed(e);
 6146                throw;
 147            }
 8148        }
 149
 150        /// <summary> This operation retrieves the built-in policy set definition with the given name. </summary>
 151        /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param>
 152        /// <param name="cancellationToken"> The cancellation token to use. </param>
 153        public virtual async Task<Response<PolicySetDefinition>> GetBuiltInAsync(string policySetDefinitionName, Cancell
 154        {
 88155            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetBuiltIn");
 88156            scope.Start();
 157            try
 158            {
 88159                return await RestClient.GetBuiltInAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false
 160            }
 0161            catch (Exception e)
 162            {
 0163                scope.Failed(e);
 0164                throw;
 165            }
 88166        }
 167
 168        /// <summary> This operation retrieves the built-in policy set definition with the given name. </summary>
 169        /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param>
 170        /// <param name="cancellationToken"> The cancellation token to use. </param>
 171        public virtual Response<PolicySetDefinition> GetBuiltIn(string policySetDefinitionName, CancellationToken cancel
 172        {
 88173            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetBuiltIn");
 88174            scope.Start();
 175            try
 176            {
 88177                return RestClient.GetBuiltIn(policySetDefinitionName, cancellationToken);
 178            }
 0179            catch (Exception e)
 180            {
 0181                scope.Failed(e);
 0182                throw;
 183            }
 88184        }
 185
 186        /// <summary> This operation creates or updates a policy set definition in the given management group with the g
 187        /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param>
 188        /// <param name="managementGroupId"> The ID of the management group. </param>
 189        /// <param name="parameters"> The policy set definition properties. </param>
 190        /// <param name="cancellationToken"> The cancellation token to use. </param>
 191        public virtual async Task<Response<PolicySetDefinition>> CreateOrUpdateAtManagementGroupAsync(string policySetDe
 192        {
 0193            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdateAtManagementG
 0194            scope.Start();
 195            try
 196            {
 0197                return await RestClient.CreateOrUpdateAtManagementGroupAsync(policySetDefinitionName, managementGroupId,
 198            }
 0199            catch (Exception e)
 200            {
 0201                scope.Failed(e);
 0202                throw;
 203            }
 0204        }
 205
 206        /// <summary> This operation creates or updates a policy set definition in the given management group with the g
 207        /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param>
 208        /// <param name="managementGroupId"> The ID of the management group. </param>
 209        /// <param name="parameters"> The policy set definition properties. </param>
 210        /// <param name="cancellationToken"> The cancellation token to use. </param>
 211        public virtual Response<PolicySetDefinition> CreateOrUpdateAtManagementGroup(string policySetDefinitionName, str
 212        {
 0213            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdateAtManagementG
 0214            scope.Start();
 215            try
 216            {
 0217                return RestClient.CreateOrUpdateAtManagementGroup(policySetDefinitionName, managementGroupId, parameters
 218            }
 0219            catch (Exception e)
 220            {
 0221                scope.Failed(e);
 0222                throw;
 223            }
 0224        }
 225
 226        /// <summary> This operation deletes the policy set definition in the given management group with the given name
 227        /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param>
 228        /// <param name="managementGroupId"> The ID of the management group. </param>
 229        /// <param name="cancellationToken"> The cancellation token to use. </param>
 230        public virtual async Task<Response> DeleteAtManagementGroupAsync(string policySetDefinitionName, string manageme
 231        {
 0232            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.DeleteAtManagementGroup");
 0233            scope.Start();
 234            try
 235            {
 0236                return await RestClient.DeleteAtManagementGroupAsync(policySetDefinitionName, managementGroupId, cancell
 237            }
 0238            catch (Exception e)
 239            {
 0240                scope.Failed(e);
 0241                throw;
 242            }
 0243        }
 244
 245        /// <summary> This operation deletes the policy set definition in the given management group with the given name
 246        /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param>
 247        /// <param name="managementGroupId"> The ID of the management group. </param>
 248        /// <param name="cancellationToken"> The cancellation token to use. </param>
 249        public virtual Response DeleteAtManagementGroup(string policySetDefinitionName, string managementGroupId, Cancel
 250        {
 0251            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.DeleteAtManagementGroup");
 0252            scope.Start();
 253            try
 254            {
 0255                return RestClient.DeleteAtManagementGroup(policySetDefinitionName, managementGroupId, cancellationToken)
 256            }
 0257            catch (Exception e)
 258            {
 0259                scope.Failed(e);
 0260                throw;
 261            }
 0262        }
 263
 264        /// <summary> This operation retrieves the policy set definition in the given management group with the given na
 265        /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param>
 266        /// <param name="managementGroupId"> The ID of the management group. </param>
 267        /// <param name="cancellationToken"> The cancellation token to use. </param>
 268        public virtual async Task<Response<PolicySetDefinition>> GetAtManagementGroupAsync(string policySetDefinitionNam
 269        {
 0270            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetAtManagementGroup");
 0271            scope.Start();
 272            try
 273            {
 0274                return await RestClient.GetAtManagementGroupAsync(policySetDefinitionName, managementGroupId, cancellati
 275            }
 0276            catch (Exception e)
 277            {
 0278                scope.Failed(e);
 0279                throw;
 280            }
 0281        }
 282
 283        /// <summary> This operation retrieves the policy set definition in the given management group with the given na
 284        /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param>
 285        /// <param name="managementGroupId"> The ID of the management group. </param>
 286        /// <param name="cancellationToken"> The cancellation token to use. </param>
 287        public virtual Response<PolicySetDefinition> GetAtManagementGroup(string policySetDefinitionName, string managem
 288        {
 0289            using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetAtManagementGroup");
 0290            scope.Start();
 291            try
 292            {
 0293                return RestClient.GetAtManagementGroup(policySetDefinitionName, managementGroupId, cancellationToken);
 294            }
 0295            catch (Exception e)
 296            {
 0297                scope.Failed(e);
 0298                throw;
 299            }
 0300        }
 301
 302        /// <summary> This operation retrieves a list of all the policy set definitions in the given subscription. </sum
 303        /// <param name="cancellationToken"> The cancellation token to use. </param>
 304        public virtual AsyncPageable<PolicySetDefinition> ListAsync(CancellationToken cancellationToken = default)
 305        {
 306            async Task<Page<PolicySetDefinition>> FirstPageFunc(int? pageSizeHint)
 307            {
 8308                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List");
 8309                scope.Start();
 310                try
 311                {
 8312                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 8313                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 314                }
 0315                catch (Exception e)
 316                {
 0317                    scope.Failed(e);
 0318                    throw;
 319                }
 8320            }
 321            async Task<Page<PolicySetDefinition>> NextPageFunc(string nextLink, int? pageSizeHint)
 322            {
 0323                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List");
 0324                scope.Start();
 325                try
 326                {
 0327                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0328                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 329                }
 0330                catch (Exception e)
 331                {
 0332                    scope.Failed(e);
 0333                    throw;
 334                }
 0335            }
 8336            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 337        }
 338
 339        /// <summary> This operation retrieves a list of all the policy set definitions in the given subscription. </sum
 340        /// <param name="cancellationToken"> The cancellation token to use. </param>
 341        public virtual Pageable<PolicySetDefinition> List(CancellationToken cancellationToken = default)
 342        {
 343            Page<PolicySetDefinition> FirstPageFunc(int? pageSizeHint)
 344            {
 8345                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List");
 8346                scope.Start();
 347                try
 348                {
 8349                    var response = RestClient.List(cancellationToken);
 8350                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 351                }
 0352                catch (Exception e)
 353                {
 0354                    scope.Failed(e);
 0355                    throw;
 356                }
 8357            }
 358            Page<PolicySetDefinition> NextPageFunc(string nextLink, int? pageSizeHint)
 359            {
 0360                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List");
 0361                scope.Start();
 362                try
 363                {
 0364                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0365                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 366                }
 0367                catch (Exception e)
 368                {
 0369                    scope.Failed(e);
 0370                    throw;
 371                }
 0372            }
 8373            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 374        }
 375
 376        /// <summary> This operation retrieves a list of all the built-in policy set definitions. </summary>
 377        /// <param name="cancellationToken"> The cancellation token to use. </param>
 378        public virtual AsyncPageable<PolicySetDefinition> ListBuiltInAsync(CancellationToken cancellationToken = default
 379        {
 380            async Task<Page<PolicySetDefinition>> FirstPageFunc(int? pageSizeHint)
 381            {
 6382                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn");
 6383                scope.Start();
 384                try
 385                {
 6386                    var response = await RestClient.ListBuiltInAsync(cancellationToken).ConfigureAwait(false);
 6387                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 388                }
 0389                catch (Exception e)
 390                {
 0391                    scope.Failed(e);
 0392                    throw;
 393                }
 6394            }
 395            async Task<Page<PolicySetDefinition>> NextPageFunc(string nextLink, int? pageSizeHint)
 396            {
 0397                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn");
 0398                scope.Start();
 399                try
 400                {
 0401                    var response = await RestClient.ListBuiltInNextPageAsync(nextLink, cancellationToken).ConfigureAwait
 0402                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 403                }
 0404                catch (Exception e)
 405                {
 0406                    scope.Failed(e);
 0407                    throw;
 408                }
 0409            }
 6410            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 411        }
 412
 413        /// <summary> This operation retrieves a list of all the built-in policy set definitions. </summary>
 414        /// <param name="cancellationToken"> The cancellation token to use. </param>
 415        public virtual Pageable<PolicySetDefinition> ListBuiltIn(CancellationToken cancellationToken = default)
 416        {
 417            Page<PolicySetDefinition> FirstPageFunc(int? pageSizeHint)
 418            {
 6419                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn");
 6420                scope.Start();
 421                try
 422                {
 6423                    var response = RestClient.ListBuiltIn(cancellationToken);
 6424                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 425                }
 0426                catch (Exception e)
 427                {
 0428                    scope.Failed(e);
 0429                    throw;
 430                }
 6431            }
 432            Page<PolicySetDefinition> NextPageFunc(string nextLink, int? pageSizeHint)
 433            {
 0434                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn");
 0435                scope.Start();
 436                try
 437                {
 0438                    var response = RestClient.ListBuiltInNextPage(nextLink, cancellationToken);
 0439                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 440                }
 0441                catch (Exception e)
 442                {
 0443                    scope.Failed(e);
 0444                    throw;
 445                }
 0446            }
 6447            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 448        }
 449
 450        /// <summary> This operation retrieves a list of all the a policy set definition in the given management group. 
 451        /// <param name="managementGroupId"> The ID of the management group. </param>
 452        /// <param name="cancellationToken"> The cancellation token to use. </param>
 453        public virtual AsyncPageable<PolicySetDefinition> ListByManagementGroupAsync(string managementGroupId, Cancellat
 454        {
 0455            if (managementGroupId == null)
 456            {
 0457                throw new ArgumentNullException(nameof(managementGroupId));
 458            }
 459
 460            async Task<Page<PolicySetDefinition>> FirstPageFunc(int? pageSizeHint)
 461            {
 0462                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup")
 0463                scope.Start();
 464                try
 465                {
 0466                    var response = await RestClient.ListByManagementGroupAsync(managementGroupId, cancellationToken).Con
 0467                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 468                }
 0469                catch (Exception e)
 470                {
 0471                    scope.Failed(e);
 0472                    throw;
 473                }
 0474            }
 475            async Task<Page<PolicySetDefinition>> NextPageFunc(string nextLink, int? pageSizeHint)
 476            {
 0477                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup")
 0478                scope.Start();
 479                try
 480                {
 0481                    var response = await RestClient.ListByManagementGroupNextPageAsync(nextLink, managementGroupId, canc
 0482                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 483                }
 0484                catch (Exception e)
 485                {
 0486                    scope.Failed(e);
 0487                    throw;
 488                }
 0489            }
 0490            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 491        }
 492
 493        /// <summary> This operation retrieves a list of all the a policy set definition in the given management group. 
 494        /// <param name="managementGroupId"> The ID of the management group. </param>
 495        /// <param name="cancellationToken"> The cancellation token to use. </param>
 496        public virtual Pageable<PolicySetDefinition> ListByManagementGroup(string managementGroupId, CancellationToken c
 497        {
 0498            if (managementGroupId == null)
 499            {
 0500                throw new ArgumentNullException(nameof(managementGroupId));
 501            }
 502
 503            Page<PolicySetDefinition> FirstPageFunc(int? pageSizeHint)
 504            {
 0505                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup")
 0506                scope.Start();
 507                try
 508                {
 0509                    var response = RestClient.ListByManagementGroup(managementGroupId, cancellationToken);
 0510                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 511                }
 0512                catch (Exception e)
 513                {
 0514                    scope.Failed(e);
 0515                    throw;
 516                }
 0517            }
 518            Page<PolicySetDefinition> NextPageFunc(string nextLink, int? pageSizeHint)
 519            {
 0520                using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup")
 0521                scope.Start();
 522                try
 523                {
 0524                    var response = RestClient.ListByManagementGroupNextPage(nextLink, managementGroupId, cancellationTok
 0525                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 526                }
 0527                catch (Exception e)
 528                {
 0529                    scope.Failed(e);
 0530                    throw;
 531                }
 0532            }
 0533            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 534        }
 535    }
 536}