< Summary

Class:Azure.ResourceManager.Network.RouteFiltersOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\RouteFiltersOperations.cs
Covered lines:32
Uncovered lines:128
Coverable lines:160
Total lines:406
Line coverage:20% (32 of 160)
Covered branches:6
Total branches:24
Branch coverage:25% (6 of 24)

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%
UpdateTagsAsync()-0%100%
UpdateTags(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%
<ListAsync()-0%100%
<ListAsync()-0%100%
ListAsync(...)-0%100%
List(...)-0%100%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%
StartCreateOrUpdateAsync()-57.14%50%
StartCreateOrUpdate(...)-57.14%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\RouteFiltersOperations.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 RouteFilters service client. </summary>
 19    public partial class RouteFiltersOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 4023        internal RouteFiltersRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of RouteFiltersOperations for mocking. </summary>
 2825        protected RouteFiltersOperations()
 26        {
 2827        }
 28        /// <summary> Initializes a new instance of RouteFiltersOperations. </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>
 2833        internal RouteFiltersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionI
 34        {
 2835            RestClient = new RouteFiltersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 2836            _clientDiagnostics = clientDiagnostics;
 2837            _pipeline = pipeline;
 2838        }
 39
 40        /// <summary> Gets the specified route filter. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="routeFilterName"> The name of the route filter. </param>
 43        /// <param name="expand"> Expands referenced express route bgp peering resources. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<RouteFilter>> GetAsync(string resourceGroupName, string routeFilterName, stri
 46        {
 847            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.Get");
 848            scope.Start();
 49            try
 50            {
 851                return await RestClient.GetAsync(resourceGroupName, routeFilterName, expand, cancellationToken).Configur
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 858        }
 59
 60        /// <summary> Gets the specified route filter. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="routeFilterName"> The name of the route filter. </param>
 63        /// <param name="expand"> Expands referenced express route bgp peering resources. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<RouteFilter> Get(string resourceGroupName, string routeFilterName, string expand = null,
 66        {
 867            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.Get");
 868            scope.Start();
 69            try
 70            {
 871                return RestClient.Get(resourceGroupName, routeFilterName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 878        }
 79
 80        /// <summary> Updates tags of a route filter. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="routeFilterName"> The name of the route filter. </param>
 83        /// <param name="parameters"> Parameters supplied to update route filter tags. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<RouteFilter>> UpdateTagsAsync(string resourceGroupName, string routeFilterNam
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.UpdateTags");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.UpdateTagsAsync(resourceGroupName, routeFilterName, parameters, cancellationToke
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Updates tags of a route filter. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="routeFilterName"> The name of the route filter. </param>
 103        /// <param name="parameters"> Parameters supplied to update route filter tags. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<RouteFilter> UpdateTags(string resourceGroupName, string routeFilterName, TagsObject par
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.UpdateTags");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.UpdateTags(resourceGroupName, routeFilterName, parameters, cancellationToken);
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Gets all route filters in a resource group. </summary>
 121        /// <param name="resourceGroupName"> The name of the resource group. </param>
 122        /// <param name="cancellationToken"> The cancellation token to use. </param>
 123        public virtual AsyncPageable<RouteFilter> ListByResourceGroupAsync(string resourceGroupName, CancellationToken c
 124        {
 0125            if (resourceGroupName == null)
 126            {
 0127                throw new ArgumentNullException(nameof(resourceGroupName));
 128            }
 129
 130            async Task<Page<RouteFilter>> FirstPageFunc(int? pageSizeHint)
 131            {
 0132                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.ListByResourceGroup");
 0133                scope.Start();
 134                try
 135                {
 0136                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0137                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 138                }
 0139                catch (Exception e)
 140                {
 0141                    scope.Failed(e);
 0142                    throw;
 143                }
 0144            }
 145            async Task<Page<RouteFilter>> NextPageFunc(string nextLink, int? pageSizeHint)
 146            {
 0147                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.ListByResourceGroup");
 0148                scope.Start();
 149                try
 150                {
 0151                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0152                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 153                }
 0154                catch (Exception e)
 155                {
 0156                    scope.Failed(e);
 0157                    throw;
 158                }
 0159            }
 0160            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 161        }
 162
 163        /// <summary> Gets all route filters in a resource group. </summary>
 164        /// <param name="resourceGroupName"> The name of the resource group. </param>
 165        /// <param name="cancellationToken"> The cancellation token to use. </param>
 166        public virtual Pageable<RouteFilter> ListByResourceGroup(string resourceGroupName, CancellationToken cancellatio
 167        {
 0168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 172
 173            Page<RouteFilter> FirstPageFunc(int? pageSizeHint)
 174            {
 0175                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.ListByResourceGroup");
 0176                scope.Start();
 177                try
 178                {
 0179                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0180                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 181                }
 0182                catch (Exception e)
 183                {
 0184                    scope.Failed(e);
 0185                    throw;
 186                }
 0187            }
 188            Page<RouteFilter> NextPageFunc(string nextLink, int? pageSizeHint)
 189            {
 0190                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.ListByResourceGroup");
 0191                scope.Start();
 192                try
 193                {
 0194                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0195                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 196                }
 0197                catch (Exception e)
 198                {
 0199                    scope.Failed(e);
 0200                    throw;
 201                }
 0202            }
 0203            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 204        }
 205
 206        /// <summary> Gets all route filters in a subscription. </summary>
 207        /// <param name="cancellationToken"> The cancellation token to use. </param>
 208        public virtual AsyncPageable<RouteFilter> ListAsync(CancellationToken cancellationToken = default)
 209        {
 210            async Task<Page<RouteFilter>> FirstPageFunc(int? pageSizeHint)
 211            {
 0212                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.List");
 0213                scope.Start();
 214                try
 215                {
 0216                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 0217                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 218                }
 0219                catch (Exception e)
 220                {
 0221                    scope.Failed(e);
 0222                    throw;
 223                }
 0224            }
 225            async Task<Page<RouteFilter>> NextPageFunc(string nextLink, int? pageSizeHint)
 226            {
 0227                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.List");
 0228                scope.Start();
 229                try
 230                {
 0231                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0232                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 233                }
 0234                catch (Exception e)
 235                {
 0236                    scope.Failed(e);
 0237                    throw;
 238                }
 0239            }
 0240            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 241        }
 242
 243        /// <summary> Gets all route filters in a subscription. </summary>
 244        /// <param name="cancellationToken"> The cancellation token to use. </param>
 245        public virtual Pageable<RouteFilter> List(CancellationToken cancellationToken = default)
 246        {
 247            Page<RouteFilter> FirstPageFunc(int? pageSizeHint)
 248            {
 0249                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.List");
 0250                scope.Start();
 251                try
 252                {
 0253                    var response = RestClient.List(cancellationToken);
 0254                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 255                }
 0256                catch (Exception e)
 257                {
 0258                    scope.Failed(e);
 0259                    throw;
 260                }
 0261            }
 262            Page<RouteFilter> NextPageFunc(string nextLink, int? pageSizeHint)
 263            {
 0264                using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.List");
 0265                scope.Start();
 266                try
 267                {
 0268                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0269                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 270                }
 0271                catch (Exception e)
 272                {
 0273                    scope.Failed(e);
 0274                    throw;
 275                }
 0276            }
 0277            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 278        }
 279
 280        /// <summary> Deletes the specified route filter. </summary>
 281        /// <param name="resourceGroupName"> The name of the resource group. </param>
 282        /// <param name="routeFilterName"> The name of the route filter. </param>
 283        /// <param name="cancellationToken"> The cancellation token to use. </param>
 284        public virtual async Task<RouteFiltersDeleteOperation> StartDeleteAsync(string resourceGroupName, string routeFi
 285        {
 0286            if (resourceGroupName == null)
 287            {
 0288                throw new ArgumentNullException(nameof(resourceGroupName));
 289            }
 0290            if (routeFilterName == null)
 291            {
 0292                throw new ArgumentNullException(nameof(routeFilterName));
 293            }
 294
 0295            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.StartDelete");
 0296            scope.Start();
 297            try
 298            {
 0299                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, routeFilterName, cancellationToke
 0300                return new RouteFiltersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(res
 301            }
 0302            catch (Exception e)
 303            {
 0304                scope.Failed(e);
 0305                throw;
 306            }
 0307        }
 308
 309        /// <summary> Deletes the specified route filter. </summary>
 310        /// <param name="resourceGroupName"> The name of the resource group. </param>
 311        /// <param name="routeFilterName"> The name of the route filter. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public virtual RouteFiltersDeleteOperation StartDelete(string resourceGroupName, string routeFilterName, Cancell
 314        {
 0315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 0319            if (routeFilterName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(routeFilterName));
 322            }
 323
 0324            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.StartDelete");
 0325            scope.Start();
 326            try
 327            {
 0328                var originalResponse = RestClient.Delete(resourceGroupName, routeFilterName, cancellationToken);
 0329                return new RouteFiltersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(res
 330            }
 0331            catch (Exception e)
 332            {
 0333                scope.Failed(e);
 0334                throw;
 335            }
 0336        }
 337
 338        /// <summary> Creates or updates a route filter in a specified resource group. </summary>
 339        /// <param name="resourceGroupName"> The name of the resource group. </param>
 340        /// <param name="routeFilterName"> The name of the route filter. </param>
 341        /// <param name="routeFilterParameters"> Parameters supplied to the create or update route filter operation. </p
 342        /// <param name="cancellationToken"> The cancellation token to use. </param>
 343        public virtual async Task<RouteFiltersCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName
 344        {
 6345            if (resourceGroupName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(resourceGroupName));
 348            }
 6349            if (routeFilterName == null)
 350            {
 0351                throw new ArgumentNullException(nameof(routeFilterName));
 352            }
 6353            if (routeFilterParameters == null)
 354            {
 0355                throw new ArgumentNullException(nameof(routeFilterParameters));
 356            }
 357
 6358            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.StartCreateOrUpdate");
 6359            scope.Start();
 360            try
 361            {
 6362                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, routeFilterName, routeFil
 6363                return new RouteFiltersCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrU
 364            }
 0365            catch (Exception e)
 366            {
 0367                scope.Failed(e);
 0368                throw;
 369            }
 6370        }
 371
 372        /// <summary> Creates or updates a route filter in a specified resource group. </summary>
 373        /// <param name="resourceGroupName"> The name of the resource group. </param>
 374        /// <param name="routeFilterName"> The name of the route filter. </param>
 375        /// <param name="routeFilterParameters"> Parameters supplied to the create or update route filter operation. </p
 376        /// <param name="cancellationToken"> The cancellation token to use. </param>
 377        public virtual RouteFiltersCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string routeFil
 378        {
 6379            if (resourceGroupName == null)
 380            {
 0381                throw new ArgumentNullException(nameof(resourceGroupName));
 382            }
 6383            if (routeFilterName == null)
 384            {
 0385                throw new ArgumentNullException(nameof(routeFilterName));
 386            }
 6387            if (routeFilterParameters == null)
 388            {
 0389                throw new ArgumentNullException(nameof(routeFilterParameters));
 390            }
 391
 6392            using var scope = _clientDiagnostics.CreateScope("RouteFiltersOperations.StartCreateOrUpdate");
 6393            scope.Start();
 394            try
 395            {
 6396                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParamete
 6397                return new RouteFiltersCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrU
 398            }
 0399            catch (Exception e)
 400            {
 0401                scope.Failed(e);
 0402                throw;
 403            }
 6404        }
 405    }
 406}