< Summary

Class:Azure.ResourceManager.Resources.AuthorizationOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\AuthorizationOperations.cs
Covered lines:0
Uncovered lines:42
Coverable lines:42
Total lines:113
Line coverage:0% (0 of 42)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
<ListAsync()-0%100%
<ListAsync()-0%100%
ListAsync(...)-0%100%
List(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\AuthorizationOperations.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 Authorization service client. </summary>
 19    public partial class AuthorizationOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal AuthorizationRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of AuthorizationOperations for mocking. </summary>
 025        protected AuthorizationOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of AuthorizationOperations. </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="endpoint"> server parameter. </param>
 032        internal AuthorizationOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null
 33        {
 034            RestClient = new AuthorizationRestOperations(clientDiagnostics, pipeline, endpoint);
 035            _clientDiagnostics = clientDiagnostics;
 036            _pipeline = pipeline;
 037        }
 38
 39        /// <summary> Lists all of the available Microsoft.Authorization REST API operations. </summary>
 40        /// <param name="cancellationToken"> The cancellation token to use. </param>
 41        public virtual AsyncPageable<OperationAutoGenerated2> ListAsync(CancellationToken cancellationToken = default)
 42        {
 43            async Task<Page<OperationAutoGenerated2>> FirstPageFunc(int? pageSizeHint)
 44            {
 045                using var scope = _clientDiagnostics.CreateScope("AuthorizationOperations.List");
 046                scope.Start();
 47                try
 48                {
 049                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 050                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 51                }
 052                catch (Exception e)
 53                {
 054                    scope.Failed(e);
 055                    throw;
 56                }
 057            }
 58            async Task<Page<OperationAutoGenerated2>> NextPageFunc(string nextLink, int? pageSizeHint)
 59            {
 060                using var scope = _clientDiagnostics.CreateScope("AuthorizationOperations.List");
 061                scope.Start();
 62                try
 63                {
 064                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 065                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 66                }
 067                catch (Exception e)
 68                {
 069                    scope.Failed(e);
 070                    throw;
 71                }
 072            }
 073            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 74        }
 75
 76        /// <summary> Lists all of the available Microsoft.Authorization REST API operations. </summary>
 77        /// <param name="cancellationToken"> The cancellation token to use. </param>
 78        public virtual Pageable<OperationAutoGenerated2> List(CancellationToken cancellationToken = default)
 79        {
 80            Page<OperationAutoGenerated2> FirstPageFunc(int? pageSizeHint)
 81            {
 082                using var scope = _clientDiagnostics.CreateScope("AuthorizationOperations.List");
 083                scope.Start();
 84                try
 85                {
 086                    var response = RestClient.List(cancellationToken);
 087                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 88                }
 089                catch (Exception e)
 90                {
 091                    scope.Failed(e);
 092                    throw;
 93                }
 094            }
 95            Page<OperationAutoGenerated2> NextPageFunc(string nextLink, int? pageSizeHint)
 96            {
 097                using var scope = _clientDiagnostics.CreateScope("AuthorizationOperations.List");
 098                scope.Start();
 99                try
 100                {
 0101                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0102                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 103                }
 0104                catch (Exception e)
 105                {
 0106                    scope.Failed(e);
 0107                    throw;
 108                }
 0109            }
 0110            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 111        }
 112    }
 113}