< Summary

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

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\ExpressRoutePortsLocationsOperations.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.Network.Models;
 15
 16namespace Azure.ResourceManager.Network
 17{
 18    /// <summary> The ExpressRoutePortsLocations service client. </summary>
 19    public partial class ExpressRoutePortsLocationsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal ExpressRoutePortsLocationsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ExpressRoutePortsLocationsOperations for mocking. </summary>
 025        protected ExpressRoutePortsLocationsOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of ExpressRoutePortsLocationsOperations. </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 subscription credentials which uniquely identify the Microsoft Azure subsc
 32        /// <param name="endpoint"> server parameter. </param>
 033        internal ExpressRoutePortsLocationsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string
 34        {
 035            RestClient = new ExpressRoutePortsLocationsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpo
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths a
 41        /// <param name="locationName"> Name of the requested ExpressRoutePort peering location. </param>
 42        /// <param name="cancellationToken"> The cancellation token to use. </param>
 43        public virtual async Task<Response<ExpressRoutePortsLocation>> GetAsync(string locationName, CancellationToken c
 44        {
 045            using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.Get");
 046            scope.Start();
 47            try
 48            {
 049                return await RestClient.GetAsync(locationName, cancellationToken).ConfigureAwait(false);
 50            }
 051            catch (Exception e)
 52            {
 053                scope.Failed(e);
 054                throw;
 55            }
 056        }
 57
 58        /// <summary> Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths a
 59        /// <param name="locationName"> Name of the requested ExpressRoutePort peering location. </param>
 60        /// <param name="cancellationToken"> The cancellation token to use. </param>
 61        public virtual Response<ExpressRoutePortsLocation> Get(string locationName, CancellationToken cancellationToken 
 62        {
 063            using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.Get");
 064            scope.Start();
 65            try
 66            {
 067                return RestClient.Get(locationName, cancellationToken);
 68            }
 069            catch (Exception e)
 70            {
 071                scope.Failed(e);
 072                throw;
 73            }
 074        }
 75
 76        /// <summary> Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each lo
 77        /// <param name="cancellationToken"> The cancellation token to use. </param>
 78        public virtual AsyncPageable<ExpressRoutePortsLocation> ListAsync(CancellationToken cancellationToken = default)
 79        {
 80            async Task<Page<ExpressRoutePortsLocation>> FirstPageFunc(int? pageSizeHint)
 81            {
 082                using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List");
 083                scope.Start();
 84                try
 85                {
 086                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 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            async Task<Page<ExpressRoutePortsLocation>> NextPageFunc(string nextLink, int? pageSizeHint)
 96            {
 097                using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List");
 098                scope.Start();
 99                try
 100                {
 0101                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 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.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 111        }
 112
 113        /// <summary> Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each lo
 114        /// <param name="cancellationToken"> The cancellation token to use. </param>
 115        public virtual Pageable<ExpressRoutePortsLocation> List(CancellationToken cancellationToken = default)
 116        {
 117            Page<ExpressRoutePortsLocation> FirstPageFunc(int? pageSizeHint)
 118            {
 0119                using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List");
 0120                scope.Start();
 121                try
 122                {
 0123                    var response = RestClient.List(cancellationToken);
 0124                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 125                }
 0126                catch (Exception e)
 127                {
 0128                    scope.Failed(e);
 0129                    throw;
 130                }
 0131            }
 132            Page<ExpressRoutePortsLocation> NextPageFunc(string nextLink, int? pageSizeHint)
 133            {
 0134                using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List");
 0135                scope.Start();
 136                try
 137                {
 0138                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0139                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 140                }
 0141                catch (Exception e)
 142                {
 0143                    scope.Failed(e);
 0144                    throw;
 145                }
 0146            }
 0147            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 148        }
 149    }
 150}