< Summary

Class:Azure.ResourceManager.EventHubs.RegionsOperations
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\RegionsOperations.cs
Covered lines:0
Uncovered lines:46
Coverable lines:46
Total lines:126
Line coverage:0% (0 of 46)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
ListBySkuAsync(...)-0%0%
<ListBySkuAsync()-0%100%
<ListBySkuAsync()-0%100%
ListBySku(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\RegionsOperations.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.EventHubs.Models;
 15
 16namespace Azure.ResourceManager.EventHubs
 17{
 18    /// <summary> The Regions service client. </summary>
 19    public partial class RegionsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal RegionsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of RegionsOperations for mocking. </summary>
 025        protected RegionsOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of RegionsOperations. </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"> Subscription credentials that uniquely identify a Microsoft Azure subscription
 32        /// <param name="endpoint"> server parameter. </param>
 033        internal RegionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Ur
 34        {
 035            RestClient = new RegionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the available Regions for a given sku. </summary>
 41        /// <param name="sku"> The sku type. </param>
 42        /// <param name="cancellationToken"> The cancellation token to use. </param>
 43        public virtual AsyncPageable<MessagingRegions> ListBySkuAsync(string sku, CancellationToken cancellationToken = 
 44        {
 045            if (sku == null)
 46            {
 047                throw new ArgumentNullException(nameof(sku));
 48            }
 49
 50            async Task<Page<MessagingRegions>> FirstPageFunc(int? pageSizeHint)
 51            {
 052                using var scope = _clientDiagnostics.CreateScope("RegionsOperations.ListBySku");
 053                scope.Start();
 54                try
 55                {
 056                    var response = await RestClient.ListBySkuAsync(sku, cancellationToken).ConfigureAwait(false);
 057                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 58                }
 059                catch (Exception e)
 60                {
 061                    scope.Failed(e);
 062                    throw;
 63                }
 064            }
 65            async Task<Page<MessagingRegions>> NextPageFunc(string nextLink, int? pageSizeHint)
 66            {
 067                using var scope = _clientDiagnostics.CreateScope("RegionsOperations.ListBySku");
 068                scope.Start();
 69                try
 70                {
 071                    var response = await RestClient.ListBySkuNextPageAsync(nextLink, sku, cancellationToken).ConfigureAw
 072                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 73                }
 074                catch (Exception e)
 75                {
 076                    scope.Failed(e);
 077                    throw;
 78                }
 079            }
 080            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 81        }
 82
 83        /// <summary> Gets the available Regions for a given sku. </summary>
 84        /// <param name="sku"> The sku type. </param>
 85        /// <param name="cancellationToken"> The cancellation token to use. </param>
 86        public virtual Pageable<MessagingRegions> ListBySku(string sku, CancellationToken cancellationToken = default)
 87        {
 088            if (sku == null)
 89            {
 090                throw new ArgumentNullException(nameof(sku));
 91            }
 92
 93            Page<MessagingRegions> FirstPageFunc(int? pageSizeHint)
 94            {
 095                using var scope = _clientDiagnostics.CreateScope("RegionsOperations.ListBySku");
 096                scope.Start();
 97                try
 98                {
 099                    var response = RestClient.ListBySku(sku, cancellationToken);
 0100                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 101                }
 0102                catch (Exception e)
 103                {
 0104                    scope.Failed(e);
 0105                    throw;
 106                }
 0107            }
 108            Page<MessagingRegions> NextPageFunc(string nextLink, int? pageSizeHint)
 109            {
 0110                using var scope = _clientDiagnostics.CreateScope("RegionsOperations.ListBySku");
 0111                scope.Start();
 112                try
 113                {
 0114                    var response = RestClient.ListBySkuNextPage(nextLink, sku, cancellationToken);
 0115                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 116                }
 0117                catch (Exception e)
 118                {
 0119                    scope.Failed(e);
 0120                    throw;
 121                }
 0122            }
 0123            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 124        }
 125    }
 126}