< Summary

Class:Azure.ResourceManager.Network.LoadBalancerBackendAddressPoolsOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancerBackendAddressPoolsOperations.cs
Covered lines:32
Uncovered lines:92
Coverable lines:124
Total lines:322
Line coverage:25.8% (32 of 124)
Covered branches:4
Total branches:36
Branch coverage:11.1% (4 of 36)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetAsync()-57.14%100%
Get(...)-57.14%100%
ListAsync(...)-38.1%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
List(...)-38.1%50%
StartCreateOrUpdateAsync()-0%0%
StartCreateOrUpdate(...)-0%0%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancerBackendAddressPoolsOperations.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 LoadBalancerBackendAddressPools service client. </summary>
 19    public partial class LoadBalancerBackendAddressPoolsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 823        internal LoadBalancerBackendAddressPoolsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of LoadBalancerBackendAddressPoolsOperations for mocking. </summary>
 825        protected LoadBalancerBackendAddressPoolsOperations()
 26        {
 827        }
 28        /// <summary> Initializes a new instance of LoadBalancerBackendAddressPoolsOperations. </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>
 833        internal LoadBalancerBackendAddressPoolsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, s
 34        {
 835            RestClient = new LoadBalancerBackendAddressPoolsRestOperations(clientDiagnostics, pipeline, subscriptionId, 
 836            _clientDiagnostics = clientDiagnostics;
 837            _pipeline = pipeline;
 838        }
 39
 40        /// <summary> Gets load balancer backend address pool. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 43        /// <param name="backendAddressPoolName"> The name of the backend address pool. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<BackendAddressPool>> GetAsync(string resourceGroupName, string loadBalancerNa
 46        {
 247            using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.Get");
 248            scope.Start();
 49            try
 50            {
 251                return await RestClient.GetAsync(resourceGroupName, loadBalancerName, backendAddressPoolName, cancellati
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 258        }
 59
 60        /// <summary> Gets load balancer backend address pool. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 63        /// <param name="backendAddressPoolName"> The name of the backend address pool. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<BackendAddressPool> Get(string resourceGroupName, string loadBalancerName, string backen
 66        {
 267            using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.Get");
 268            scope.Start();
 69            try
 70            {
 271                return RestClient.Get(resourceGroupName, loadBalancerName, backendAddressPoolName, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 278        }
 79
 80        /// <summary> Gets all the load balancer backed address pools. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 83        /// <param name="cancellationToken"> The cancellation token to use. </param>
 84        public virtual AsyncPageable<BackendAddressPool> ListAsync(string resourceGroupName, string loadBalancerName, Ca
 85        {
 286            if (resourceGroupName == null)
 87            {
 088                throw new ArgumentNullException(nameof(resourceGroupName));
 89            }
 290            if (loadBalancerName == null)
 91            {
 092                throw new ArgumentNullException(nameof(loadBalancerName));
 93            }
 94
 95            async Task<Page<BackendAddressPool>> FirstPageFunc(int? pageSizeHint)
 96            {
 297                using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.List");
 298                scope.Start();
 99                try
 100                {
 2101                    var response = await RestClient.ListAsync(resourceGroupName, loadBalancerName, cancellationToken).Co
 2102                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 103                }
 0104                catch (Exception e)
 105                {
 0106                    scope.Failed(e);
 0107                    throw;
 108                }
 2109            }
 110            async Task<Page<BackendAddressPool>> NextPageFunc(string nextLink, int? pageSizeHint)
 111            {
 0112                using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.List");
 0113                scope.Start();
 114                try
 115                {
 0116                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, loadBalancerName, can
 0117                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 118                }
 0119                catch (Exception e)
 120                {
 0121                    scope.Failed(e);
 0122                    throw;
 123                }
 0124            }
 2125            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 126        }
 127
 128        /// <summary> Gets all the load balancer backed address pools. </summary>
 129        /// <param name="resourceGroupName"> The name of the resource group. </param>
 130        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 131        /// <param name="cancellationToken"> The cancellation token to use. </param>
 132        public virtual Pageable<BackendAddressPool> List(string resourceGroupName, string loadBalancerName, Cancellation
 133        {
 2134            if (resourceGroupName == null)
 135            {
 0136                throw new ArgumentNullException(nameof(resourceGroupName));
 137            }
 2138            if (loadBalancerName == null)
 139            {
 0140                throw new ArgumentNullException(nameof(loadBalancerName));
 141            }
 142
 143            Page<BackendAddressPool> FirstPageFunc(int? pageSizeHint)
 144            {
 2145                using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.List");
 2146                scope.Start();
 147                try
 148                {
 2149                    var response = RestClient.List(resourceGroupName, loadBalancerName, cancellationToken);
 2150                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 151                }
 0152                catch (Exception e)
 153                {
 0154                    scope.Failed(e);
 0155                    throw;
 156                }
 2157            }
 158            Page<BackendAddressPool> NextPageFunc(string nextLink, int? pageSizeHint)
 159            {
 0160                using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.List");
 0161                scope.Start();
 162                try
 163                {
 0164                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, loadBalancerName, cancellationTo
 0165                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 166                }
 0167                catch (Exception e)
 168                {
 0169                    scope.Failed(e);
 0170                    throw;
 171                }
 0172            }
 2173            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 174        }
 175
 176        /// <summary> Creates or updates a load balancer backend address pool. </summary>
 177        /// <param name="resourceGroupName"> The name of the resource group. </param>
 178        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 179        /// <param name="backendAddressPoolName"> The name of the backend address pool. </param>
 180        /// <param name="parameters"> Parameters supplied to the create or update load balancer backend address pool ope
 181        /// <param name="cancellationToken"> The cancellation token to use. </param>
 182        public virtual async Task<LoadBalancerBackendAddressPoolsCreateOrUpdateOperation> StartCreateOrUpdateAsync(strin
 183        {
 0184            if (resourceGroupName == null)
 185            {
 0186                throw new ArgumentNullException(nameof(resourceGroupName));
 187            }
 0188            if (loadBalancerName == null)
 189            {
 0190                throw new ArgumentNullException(nameof(loadBalancerName));
 191            }
 0192            if (backendAddressPoolName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(backendAddressPoolName));
 195            }
 0196            if (parameters == null)
 197            {
 0198                throw new ArgumentNullException(nameof(parameters));
 199            }
 200
 0201            using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.StartCreateOrUpd
 0202            scope.Start();
 203            try
 204            {
 0205                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, loadBalancerName, backend
 0206                return new LoadBalancerBackendAddressPoolsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCli
 207            }
 0208            catch (Exception e)
 209            {
 0210                scope.Failed(e);
 0211                throw;
 212            }
 0213        }
 214
 215        /// <summary> Creates or updates a load balancer backend address pool. </summary>
 216        /// <param name="resourceGroupName"> The name of the resource group. </param>
 217        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 218        /// <param name="backendAddressPoolName"> The name of the backend address pool. </param>
 219        /// <param name="parameters"> Parameters supplied to the create or update load balancer backend address pool ope
 220        /// <param name="cancellationToken"> The cancellation token to use. </param>
 221        public virtual LoadBalancerBackendAddressPoolsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupNa
 222        {
 0223            if (resourceGroupName == null)
 224            {
 0225                throw new ArgumentNullException(nameof(resourceGroupName));
 226            }
 0227            if (loadBalancerName == null)
 228            {
 0229                throw new ArgumentNullException(nameof(loadBalancerName));
 230            }
 0231            if (backendAddressPoolName == null)
 232            {
 0233                throw new ArgumentNullException(nameof(backendAddressPoolName));
 234            }
 0235            if (parameters == null)
 236            {
 0237                throw new ArgumentNullException(nameof(parameters));
 238            }
 239
 0240            using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.StartCreateOrUpd
 0241            scope.Start();
 242            try
 243            {
 0244                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, loadBalancerName, backendAddressPool
 0245                return new LoadBalancerBackendAddressPoolsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCli
 246            }
 0247            catch (Exception e)
 248            {
 0249                scope.Failed(e);
 0250                throw;
 251            }
 0252        }
 253
 254        /// <summary> Deletes the specified load balancer backend address pool. </summary>
 255        /// <param name="resourceGroupName"> The name of the resource group. </param>
 256        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 257        /// <param name="backendAddressPoolName"> The name of the backend address pool. </param>
 258        /// <param name="cancellationToken"> The cancellation token to use. </param>
 259        public virtual async Task<LoadBalancerBackendAddressPoolsDeleteOperation> StartDeleteAsync(string resourceGroupN
 260        {
 0261            if (resourceGroupName == null)
 262            {
 0263                throw new ArgumentNullException(nameof(resourceGroupName));
 264            }
 0265            if (loadBalancerName == null)
 266            {
 0267                throw new ArgumentNullException(nameof(loadBalancerName));
 268            }
 0269            if (backendAddressPoolName == null)
 270            {
 0271                throw new ArgumentNullException(nameof(backendAddressPoolName));
 272            }
 273
 0274            using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.StartDelete");
 0275            scope.Start();
 276            try
 277            {
 0278                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, loadBalancerName, backendAddressP
 0279                return new LoadBalancerBackendAddressPoolsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Crea
 280            }
 0281            catch (Exception e)
 282            {
 0283                scope.Failed(e);
 0284                throw;
 285            }
 0286        }
 287
 288        /// <summary> Deletes the specified load balancer backend address pool. </summary>
 289        /// <param name="resourceGroupName"> The name of the resource group. </param>
 290        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 291        /// <param name="backendAddressPoolName"> The name of the backend address pool. </param>
 292        /// <param name="cancellationToken"> The cancellation token to use. </param>
 293        public virtual LoadBalancerBackendAddressPoolsDeleteOperation StartDelete(string resourceGroupName, string loadB
 294        {
 0295            if (resourceGroupName == null)
 296            {
 0297                throw new ArgumentNullException(nameof(resourceGroupName));
 298            }
 0299            if (loadBalancerName == null)
 300            {
 0301                throw new ArgumentNullException(nameof(loadBalancerName));
 302            }
 0303            if (backendAddressPoolName == null)
 304            {
 0305                throw new ArgumentNullException(nameof(backendAddressPoolName));
 306            }
 307
 0308            using var scope = _clientDiagnostics.CreateScope("LoadBalancerBackendAddressPoolsOperations.StartDelete");
 0309            scope.Start();
 310            try
 311            {
 0312                var originalResponse = RestClient.Delete(resourceGroupName, loadBalancerName, backendAddressPoolName, ca
 0313                return new LoadBalancerBackendAddressPoolsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Crea
 314            }
 0315            catch (Exception e)
 316            {
 0317                scope.Failed(e);
 0318                throw;
 319            }
 0320        }
 321    }
 322}