< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
GetAsync()-0%100%
Get(...)-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()-0%0%
StartCreateOrUpdate(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\VirtualRoutersOperations.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 VirtualRouters service client. </summary>
 19    public partial class VirtualRoutersOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal VirtualRoutersRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of VirtualRoutersOperations for mocking. </summary>
 025        protected VirtualRoutersOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of VirtualRoutersOperations. </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 VirtualRoutersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio
 34        {
 035            RestClient = new VirtualRoutersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the specified Virtual Router. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="virtualRouterName"> The name of the Virtual Router. </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<VirtualRouter>> GetAsync(string resourceGroupName, string virtualRouterName, 
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.Get");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.GetAsync(resourceGroupName, virtualRouterName, expand, cancellationToken).Config
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Gets the specified Virtual Router. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 63        /// <param name="expand"> Expands referenced resources. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<VirtualRouter> Get(string resourceGroupName, string virtualRouterName, string expand = n
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.Get");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Get(resourceGroupName, virtualRouterName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Lists all Virtual Routers in a resource group. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="cancellationToken"> The cancellation token to use. </param>
 83        public virtual AsyncPageable<VirtualRouter> ListByResourceGroupAsync(string resourceGroupName, CancellationToken
 84        {
 085            if (resourceGroupName == null)
 86            {
 087                throw new ArgumentNullException(nameof(resourceGroupName));
 88            }
 89
 90            async Task<Page<VirtualRouter>> FirstPageFunc(int? pageSizeHint)
 91            {
 092                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.ListByResourceGroup");
 093                scope.Start();
 94                try
 95                {
 096                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 097                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 98                }
 099                catch (Exception e)
 100                {
 0101                    scope.Failed(e);
 0102                    throw;
 103                }
 0104            }
 105            async Task<Page<VirtualRouter>> NextPageFunc(string nextLink, int? pageSizeHint)
 106            {
 0107                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.ListByResourceGroup");
 0108                scope.Start();
 109                try
 110                {
 0111                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0112                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 113                }
 0114                catch (Exception e)
 115                {
 0116                    scope.Failed(e);
 0117                    throw;
 118                }
 0119            }
 0120            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 121        }
 122
 123        /// <summary> Lists all Virtual Routers in a resource group. </summary>
 124        /// <param name="resourceGroupName"> The name of the resource group. </param>
 125        /// <param name="cancellationToken"> The cancellation token to use. </param>
 126        public virtual Pageable<VirtualRouter> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat
 127        {
 0128            if (resourceGroupName == null)
 129            {
 0130                throw new ArgumentNullException(nameof(resourceGroupName));
 131            }
 132
 133            Page<VirtualRouter> FirstPageFunc(int? pageSizeHint)
 134            {
 0135                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.ListByResourceGroup");
 0136                scope.Start();
 137                try
 138                {
 0139                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0140                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 141                }
 0142                catch (Exception e)
 143                {
 0144                    scope.Failed(e);
 0145                    throw;
 146                }
 0147            }
 148            Page<VirtualRouter> NextPageFunc(string nextLink, int? pageSizeHint)
 149            {
 0150                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.ListByResourceGroup");
 0151                scope.Start();
 152                try
 153                {
 0154                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0155                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 156                }
 0157                catch (Exception e)
 158                {
 0159                    scope.Failed(e);
 0160                    throw;
 161                }
 0162            }
 0163            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 164        }
 165
 166        /// <summary> Gets all the Virtual Routers in a subscription. </summary>
 167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 168        public virtual AsyncPageable<VirtualRouter> ListAsync(CancellationToken cancellationToken = default)
 169        {
 170            async Task<Page<VirtualRouter>> FirstPageFunc(int? pageSizeHint)
 171            {
 0172                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.List");
 0173                scope.Start();
 174                try
 175                {
 0176                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 0177                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 178                }
 0179                catch (Exception e)
 180                {
 0181                    scope.Failed(e);
 0182                    throw;
 183                }
 0184            }
 185            async Task<Page<VirtualRouter>> NextPageFunc(string nextLink, int? pageSizeHint)
 186            {
 0187                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.List");
 0188                scope.Start();
 189                try
 190                {
 0191                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0192                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 193                }
 0194                catch (Exception e)
 195                {
 0196                    scope.Failed(e);
 0197                    throw;
 198                }
 0199            }
 0200            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 201        }
 202
 203        /// <summary> Gets all the Virtual Routers in a subscription. </summary>
 204        /// <param name="cancellationToken"> The cancellation token to use. </param>
 205        public virtual Pageable<VirtualRouter> List(CancellationToken cancellationToken = default)
 206        {
 207            Page<VirtualRouter> FirstPageFunc(int? pageSizeHint)
 208            {
 0209                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.List");
 0210                scope.Start();
 211                try
 212                {
 0213                    var response = RestClient.List(cancellationToken);
 0214                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 215                }
 0216                catch (Exception e)
 217                {
 0218                    scope.Failed(e);
 0219                    throw;
 220                }
 0221            }
 222            Page<VirtualRouter> NextPageFunc(string nextLink, int? pageSizeHint)
 223            {
 0224                using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.List");
 0225                scope.Start();
 226                try
 227                {
 0228                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0229                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 230                }
 0231                catch (Exception e)
 232                {
 0233                    scope.Failed(e);
 0234                    throw;
 235                }
 0236            }
 0237            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 238        }
 239
 240        /// <summary> Deletes the specified Virtual Router. </summary>
 241        /// <param name="resourceGroupName"> The name of the resource group. </param>
 242        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 243        /// <param name="cancellationToken"> The cancellation token to use. </param>
 244        public virtual async Task<VirtualRoutersDeleteOperation> StartDeleteAsync(string resourceGroupName, string virtu
 245        {
 0246            if (resourceGroupName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(resourceGroupName));
 249            }
 0250            if (virtualRouterName == null)
 251            {
 0252                throw new ArgumentNullException(nameof(virtualRouterName));
 253            }
 254
 0255            using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.StartDelete");
 0256            scope.Start();
 257            try
 258            {
 0259                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, virtualRouterName, cancellationTo
 0260                return new VirtualRoutersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r
 261            }
 0262            catch (Exception e)
 263            {
 0264                scope.Failed(e);
 0265                throw;
 266            }
 0267        }
 268
 269        /// <summary> Deletes the specified Virtual Router. </summary>
 270        /// <param name="resourceGroupName"> The name of the resource group. </param>
 271        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public virtual VirtualRoutersDeleteOperation StartDelete(string resourceGroupName, string virtualRouterName, Can
 274        {
 0275            if (resourceGroupName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(resourceGroupName));
 278            }
 0279            if (virtualRouterName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(virtualRouterName));
 282            }
 283
 0284            using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.StartDelete");
 0285            scope.Start();
 286            try
 287            {
 0288                var originalResponse = RestClient.Delete(resourceGroupName, virtualRouterName, cancellationToken);
 0289                return new VirtualRoutersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r
 290            }
 0291            catch (Exception e)
 292            {
 0293                scope.Failed(e);
 0294                throw;
 295            }
 0296        }
 297
 298        /// <summary> Creates or updates the specified Virtual Router. </summary>
 299        /// <param name="resourceGroupName"> The name of the resource group. </param>
 300        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 301        /// <param name="parameters"> Parameters supplied to the create or update Virtual Router. </param>
 302        /// <param name="cancellationToken"> The cancellation token to use. </param>
 303        public virtual async Task<VirtualRoutersCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupNa
 304        {
 0305            if (resourceGroupName == null)
 306            {
 0307                throw new ArgumentNullException(nameof(resourceGroupName));
 308            }
 0309            if (virtualRouterName == null)
 310            {
 0311                throw new ArgumentNullException(nameof(virtualRouterName));
 312            }
 0313            if (parameters == null)
 314            {
 0315                throw new ArgumentNullException(nameof(parameters));
 316            }
 317
 0318            using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.StartCreateOrUpdate");
 0319            scope.Start();
 320            try
 321            {
 0322                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, virtualRouterName, parame
 0323                return new VirtualRoutersCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateO
 324            }
 0325            catch (Exception e)
 326            {
 0327                scope.Failed(e);
 0328                throw;
 329            }
 0330        }
 331
 332        /// <summary> Creates or updates the specified Virtual Router. </summary>
 333        /// <param name="resourceGroupName"> The name of the resource group. </param>
 334        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 335        /// <param name="parameters"> Parameters supplied to the create or update Virtual Router. </param>
 336        /// <param name="cancellationToken"> The cancellation token to use. </param>
 337        public virtual VirtualRoutersCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string virtua
 338        {
 0339            if (resourceGroupName == null)
 340            {
 0341                throw new ArgumentNullException(nameof(resourceGroupName));
 342            }
 0343            if (virtualRouterName == null)
 344            {
 0345                throw new ArgumentNullException(nameof(virtualRouterName));
 346            }
 0347            if (parameters == null)
 348            {
 0349                throw new ArgumentNullException(nameof(parameters));
 350            }
 351
 0352            using var scope = _clientDiagnostics.CreateScope("VirtualRoutersOperations.StartCreateOrUpdate");
 0353            scope.Start();
 354            try
 355            {
 0356                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, virtualRouterName, parameters, cance
 0357                return new VirtualRoutersCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateO
 358            }
 0359            catch (Exception e)
 360            {
 0361                scope.Failed(e);
 0362                throw;
 363            }
 0364        }
 365    }
 366}