< Summary

Class:Azure.ResourceManager.Network.RouteTablesOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\RouteTablesOperations.cs
Covered lines:60
Uncovered lines:100
Coverable lines:160
Total lines:406
Line coverage:37.5% (60 of 160)
Covered branches:12
Total branches:24
Branch coverage:50% (12 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%
ListAsync(...)-36.84%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
List(...)-36.84%50%
<ListAllAsync()-0%100%
<ListAllAsync()-0%100%
ListAllAsync(...)-0%100%
ListAll(...)-0%100%
StartDeleteAsync()-58.33%50%
StartDelete(...)-58.33%50%
StartCreateOrUpdateAsync()-57.14%50%
StartCreateOrUpdate(...)-57.14%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\RouteTablesOperations.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 RouteTables service client. </summary>
 19    public partial class RouteTablesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 15223        internal RouteTablesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of RouteTablesOperations for mocking. </summary>
 10825        protected RouteTablesOperations()
 26        {
 10827        }
 28        /// <summary> Initializes a new instance of RouteTablesOperations. </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>
 10833        internal RouteTablesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId
 34        {
 10835            RestClient = new RouteTablesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 10836            _clientDiagnostics = clientDiagnostics;
 10837            _pipeline = pipeline;
 10838        }
 39
 40        /// <summary> Gets the specified route table. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="routeTableName"> The name of the route table. </param>
 43        /// <param name="expand"> Expands referenced resources. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<RouteTable>> GetAsync(string resourceGroupName, string routeTableName, string
 46        {
 2247            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.Get");
 2248            scope.Start();
 49            try
 50            {
 2251                return await RestClient.GetAsync(resourceGroupName, routeTableName, expand, cancellationToken).Configure
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 2258        }
 59
 60        /// <summary> Gets the specified route table. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="routeTableName"> The name of the route table. </param>
 63        /// <param name="expand"> Expands referenced resources. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<RouteTable> Get(string resourceGroupName, string routeTableName, string expand = null, C
 66        {
 2267            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.Get");
 2268            scope.Start();
 69            try
 70            {
 2271                return RestClient.Get(resourceGroupName, routeTableName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 2278        }
 79
 80        /// <summary> Updates a route table tags. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="routeTableName"> The name of the route table. </param>
 83        /// <param name="parameters"> Parameters supplied to update route table tags. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<RouteTable>> UpdateTagsAsync(string resourceGroupName, string routeTableName,
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.UpdateTags");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.UpdateTagsAsync(resourceGroupName, routeTableName, parameters, cancellationToken
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Updates a route table tags. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="routeTableName"> The name of the route table. </param>
 103        /// <param name="parameters"> Parameters supplied to update route table tags. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<RouteTable> UpdateTags(string resourceGroupName, string routeTableName, TagsObject param
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.UpdateTags");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.UpdateTags(resourceGroupName, routeTableName, parameters, cancellationToken);
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Gets all route tables 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<RouteTable> ListAsync(string resourceGroupName, CancellationToken cancellationToken
 124        {
 10125            if (resourceGroupName == null)
 126            {
 0127                throw new ArgumentNullException(nameof(resourceGroupName));
 128            }
 129
 130            async Task<Page<RouteTable>> FirstPageFunc(int? pageSizeHint)
 131            {
 10132                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List");
 10133                scope.Start();
 134                try
 135                {
 10136                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 10137                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 138                }
 0139                catch (Exception e)
 140                {
 0141                    scope.Failed(e);
 0142                    throw;
 143                }
 10144            }
 145            async Task<Page<RouteTable>> NextPageFunc(string nextLink, int? pageSizeHint)
 146            {
 0147                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List");
 0148                scope.Start();
 149                try
 150                {
 0151                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 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            }
 10160            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 161        }
 162
 163        /// <summary> Gets all route tables 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<RouteTable> List(string resourceGroupName, CancellationToken cancellationToken = default
 167        {
 10168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 172
 173            Page<RouteTable> FirstPageFunc(int? pageSizeHint)
 174            {
 10175                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List");
 10176                scope.Start();
 177                try
 178                {
 10179                    var response = RestClient.List(resourceGroupName, cancellationToken);
 10180                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 181                }
 0182                catch (Exception e)
 183                {
 0184                    scope.Failed(e);
 0185                    throw;
 186                }
 10187            }
 188            Page<RouteTable> NextPageFunc(string nextLink, int? pageSizeHint)
 189            {
 0190                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List");
 0191                scope.Start();
 192                try
 193                {
 0194                    var response = RestClient.ListNextPage(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            }
 10203            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 204        }
 205
 206        /// <summary> Gets all route tables in a subscription. </summary>
 207        /// <param name="cancellationToken"> The cancellation token to use. </param>
 208        public virtual AsyncPageable<RouteTable> ListAllAsync(CancellationToken cancellationToken = default)
 209        {
 210            async Task<Page<RouteTable>> FirstPageFunc(int? pageSizeHint)
 211            {
 0212                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll");
 0213                scope.Start();
 214                try
 215                {
 0216                    var response = await RestClient.ListAllAsync(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<RouteTable>> NextPageFunc(string nextLink, int? pageSizeHint)
 226            {
 0227                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll");
 0228                scope.Start();
 229                try
 230                {
 0231                    var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal
 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 tables in a subscription. </summary>
 244        /// <param name="cancellationToken"> The cancellation token to use. </param>
 245        public virtual Pageable<RouteTable> ListAll(CancellationToken cancellationToken = default)
 246        {
 247            Page<RouteTable> FirstPageFunc(int? pageSizeHint)
 248            {
 0249                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll");
 0250                scope.Start();
 251                try
 252                {
 0253                    var response = RestClient.ListAll(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<RouteTable> NextPageFunc(string nextLink, int? pageSizeHint)
 263            {
 0264                using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll");
 0265                scope.Start();
 266                try
 267                {
 0268                    var response = RestClient.ListAllNextPage(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 table. </summary>
 281        /// <param name="resourceGroupName"> The name of the resource group. </param>
 282        /// <param name="routeTableName"> The name of the route table. </param>
 283        /// <param name="cancellationToken"> The cancellation token to use. </param>
 284        public virtual async Task<RouteTablesDeleteOperation> StartDeleteAsync(string resourceGroupName, string routeTab
 285        {
 8286            if (resourceGroupName == null)
 287            {
 0288                throw new ArgumentNullException(nameof(resourceGroupName));
 289            }
 8290            if (routeTableName == null)
 291            {
 0292                throw new ArgumentNullException(nameof(routeTableName));
 293            }
 294
 8295            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartDelete");
 8296            scope.Start();
 297            try
 298            {
 8299                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, routeTableName, cancellationToken
 8300                return new RouteTablesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(reso
 301            }
 0302            catch (Exception e)
 303            {
 0304                scope.Failed(e);
 0305                throw;
 306            }
 8307        }
 308
 309        /// <summary> Deletes the specified route table. </summary>
 310        /// <param name="resourceGroupName"> The name of the resource group. </param>
 311        /// <param name="routeTableName"> The name of the route table. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public virtual RouteTablesDeleteOperation StartDelete(string resourceGroupName, string routeTableName, Cancellat
 314        {
 8315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 8319            if (routeTableName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(routeTableName));
 322            }
 323
 8324            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartDelete");
 8325            scope.Start();
 326            try
 327            {
 8328                var originalResponse = RestClient.Delete(resourceGroupName, routeTableName, cancellationToken);
 8329                return new RouteTablesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(reso
 330            }
 0331            catch (Exception e)
 332            {
 0333                scope.Failed(e);
 0334                throw;
 335            }
 8336        }
 337
 338        /// <summary> Create or updates a route table in a specified resource group. </summary>
 339        /// <param name="resourceGroupName"> The name of the resource group. </param>
 340        /// <param name="routeTableName"> The name of the route table. </param>
 341        /// <param name="parameters"> Parameters supplied to the create or update route table operation. </param>
 342        /// <param name="cancellationToken"> The cancellation token to use. </param>
 343        public virtual async Task<RouteTablesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName,
 344        {
 14345            if (resourceGroupName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(resourceGroupName));
 348            }
 14349            if (routeTableName == null)
 350            {
 0351                throw new ArgumentNullException(nameof(routeTableName));
 352            }
 14353            if (parameters == null)
 354            {
 0355                throw new ArgumentNullException(nameof(parameters));
 356            }
 357
 14358            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartCreateOrUpdate");
 14359            scope.Start();
 360            try
 361            {
 14362                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, routeTableName, parameter
 14363                return new RouteTablesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUp
 364            }
 0365            catch (Exception e)
 366            {
 0367                scope.Failed(e);
 0368                throw;
 369            }
 14370        }
 371
 372        /// <summary> Create or updates a route table in a specified resource group. </summary>
 373        /// <param name="resourceGroupName"> The name of the resource group. </param>
 374        /// <param name="routeTableName"> The name of the route table. </param>
 375        /// <param name="parameters"> Parameters supplied to the create or update route table operation. </param>
 376        /// <param name="cancellationToken"> The cancellation token to use. </param>
 377        public virtual RouteTablesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string routeTabl
 378        {
 14379            if (resourceGroupName == null)
 380            {
 0381                throw new ArgumentNullException(nameof(resourceGroupName));
 382            }
 14383            if (routeTableName == null)
 384            {
 0385                throw new ArgumentNullException(nameof(routeTableName));
 386            }
 14387            if (parameters == null)
 388            {
 0389                throw new ArgumentNullException(nameof(parameters));
 390            }
 391
 14392            using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartCreateOrUpdate");
 14393            scope.Start();
 394            try
 395            {
 14396                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, routeTableName, parameters, cancella
 14397                return new RouteTablesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUp
 398            }
 0399            catch (Exception e)
 400            {
 0401                scope.Failed(e);
 0402                throw;
 403            }
 14404        }
 405    }
 406}