< Summary

Class:Azure.ResourceManager.Network.LocalNetworkGatewaysOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LocalNetworkGatewaysOperations.cs
Covered lines:60
Uncovered lines:66
Coverable lines:126
Total lines:330
Line coverage:47.6% (60 of 126)
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%
StartCreateOrUpdateAsync()-57.14%50%
StartCreateOrUpdate(...)-57.14%50%
StartDeleteAsync()-58.33%50%
StartDelete(...)-58.33%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LocalNetworkGatewaysOperations.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 LocalNetworkGateways service client. </summary>
 19    public partial class LocalNetworkGatewaysOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 7623        internal LocalNetworkGatewaysRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of LocalNetworkGatewaysOperations for mocking. </summary>
 5225        protected LocalNetworkGatewaysOperations()
 26        {
 5227        }
 28        /// <summary> Initializes a new instance of LocalNetworkGatewaysOperations. </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>
 5233        internal LocalNetworkGatewaysOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc
 34        {
 5235            RestClient = new LocalNetworkGatewaysRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 5236            _clientDiagnostics = clientDiagnostics;
 5237            _pipeline = pipeline;
 5238        }
 39
 40        /// <summary> Gets the specified local network gateway in a resource group. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<LocalNetworkGateway>> GetAsync(string resourceGroupName, string localNetworkG
 45        {
 1046            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.Get");
 1047            scope.Start();
 48            try
 49            {
 1050                return await RestClient.GetAsync(resourceGroupName, localNetworkGatewayName, cancellationToken).Configur
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 1057        }
 58
 59        /// <summary> Gets the specified local network gateway in a resource group. </summary>
 60        /// <param name="resourceGroupName"> The name of the resource group. </param>
 61        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<LocalNetworkGateway> Get(string resourceGroupName, string localNetworkGatewayName, Cance
 64        {
 1065            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.Get");
 1066            scope.Start();
 67            try
 68            {
 1069                return RestClient.Get(resourceGroupName, localNetworkGatewayName, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 1076        }
 77
 78        /// <summary> Updates a local network gateway tags. </summary>
 79        /// <param name="resourceGroupName"> The name of the resource group. </param>
 80        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 81        /// <param name="parameters"> Parameters supplied to update local network gateway tags. </param>
 82        /// <param name="cancellationToken"> The cancellation token to use. </param>
 83        public virtual async Task<Response<LocalNetworkGateway>> UpdateTagsAsync(string resourceGroupName, string localN
 84        {
 085            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.UpdateTags");
 086            scope.Start();
 87            try
 88            {
 089                return await RestClient.UpdateTagsAsync(resourceGroupName, localNetworkGatewayName, parameters, cancella
 90            }
 091            catch (Exception e)
 92            {
 093                scope.Failed(e);
 094                throw;
 95            }
 096        }
 97
 98        /// <summary> Updates a local network gateway tags. </summary>
 99        /// <param name="resourceGroupName"> The name of the resource group. </param>
 100        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 101        /// <param name="parameters"> Parameters supplied to update local network gateway tags. </param>
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<LocalNetworkGateway> UpdateTags(string resourceGroupName, string localNetworkGatewayName
 104        {
 0105            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.UpdateTags");
 0106            scope.Start();
 107            try
 108            {
 0109                return RestClient.UpdateTags(resourceGroupName, localNetworkGatewayName, parameters, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 0116        }
 117
 118        /// <summary> Gets all the local network gateways in a resource group. </summary>
 119        /// <param name="resourceGroupName"> The name of the resource group. </param>
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public virtual AsyncPageable<LocalNetworkGateway> ListAsync(string resourceGroupName, CancellationToken cancella
 122        {
 4123            if (resourceGroupName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(resourceGroupName));
 126            }
 127
 128            async Task<Page<LocalNetworkGateway>> FirstPageFunc(int? pageSizeHint)
 129            {
 4130                using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List");
 4131                scope.Start();
 132                try
 133                {
 4134                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 4135                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 136                }
 0137                catch (Exception e)
 138                {
 0139                    scope.Failed(e);
 0140                    throw;
 141                }
 4142            }
 143            async Task<Page<LocalNetworkGateway>> NextPageFunc(string nextLink, int? pageSizeHint)
 144            {
 0145                using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List");
 0146                scope.Start();
 147                try
 148                {
 0149                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 0150                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 151                }
 0152                catch (Exception e)
 153                {
 0154                    scope.Failed(e);
 0155                    throw;
 156                }
 0157            }
 4158            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 159        }
 160
 161        /// <summary> Gets all the local network gateways in a resource group. </summary>
 162        /// <param name="resourceGroupName"> The name of the resource group. </param>
 163        /// <param name="cancellationToken"> The cancellation token to use. </param>
 164        public virtual Pageable<LocalNetworkGateway> List(string resourceGroupName, CancellationToken cancellationToken 
 165        {
 4166            if (resourceGroupName == null)
 167            {
 0168                throw new ArgumentNullException(nameof(resourceGroupName));
 169            }
 170
 171            Page<LocalNetworkGateway> FirstPageFunc(int? pageSizeHint)
 172            {
 4173                using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List");
 4174                scope.Start();
 175                try
 176                {
 4177                    var response = RestClient.List(resourceGroupName, cancellationToken);
 4178                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 179                }
 0180                catch (Exception e)
 181                {
 0182                    scope.Failed(e);
 0183                    throw;
 184                }
 4185            }
 186            Page<LocalNetworkGateway> NextPageFunc(string nextLink, int? pageSizeHint)
 187            {
 0188                using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List");
 0189                scope.Start();
 190                try
 191                {
 0192                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
 0193                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 194                }
 0195                catch (Exception e)
 196                {
 0197                    scope.Failed(e);
 0198                    throw;
 199                }
 0200            }
 4201            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 202        }
 203
 204        /// <summary> Creates or updates a local network gateway in the specified resource group. </summary>
 205        /// <param name="resourceGroupName"> The name of the resource group. </param>
 206        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 207        /// <param name="parameters"> Parameters supplied to the create or update local network gateway operation. </par
 208        /// <param name="cancellationToken"> The cancellation token to use. </param>
 209        public virtual async Task<LocalNetworkGatewaysCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceG
 210        {
 10211            if (resourceGroupName == null)
 212            {
 0213                throw new ArgumentNullException(nameof(resourceGroupName));
 214            }
 10215            if (localNetworkGatewayName == null)
 216            {
 0217                throw new ArgumentNullException(nameof(localNetworkGatewayName));
 218            }
 10219            if (parameters == null)
 220            {
 0221                throw new ArgumentNullException(nameof(parameters));
 222            }
 223
 10224            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartCreateOrUpdate");
 10225            scope.Start();
 226            try
 227            {
 10228                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, localNetworkGatewayName, 
 10229                return new LocalNetworkGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC
 230            }
 0231            catch (Exception e)
 232            {
 0233                scope.Failed(e);
 0234                throw;
 235            }
 10236        }
 237
 238        /// <summary> Creates or updates a local network gateway in the specified resource group. </summary>
 239        /// <param name="resourceGroupName"> The name of the resource group. </param>
 240        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 241        /// <param name="parameters"> Parameters supplied to the create or update local network gateway operation. </par
 242        /// <param name="cancellationToken"> The cancellation token to use. </param>
 243        public virtual LocalNetworkGatewaysCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string 
 244        {
 10245            if (resourceGroupName == null)
 246            {
 0247                throw new ArgumentNullException(nameof(resourceGroupName));
 248            }
 10249            if (localNetworkGatewayName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(localNetworkGatewayName));
 252            }
 10253            if (parameters == null)
 254            {
 0255                throw new ArgumentNullException(nameof(parameters));
 256            }
 257
 10258            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartCreateOrUpdate");
 10259            scope.Start();
 260            try
 261            {
 10262                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, localNetworkGatewayName, parameters,
 10263                return new LocalNetworkGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC
 264            }
 0265            catch (Exception e)
 266            {
 0267                scope.Failed(e);
 0268                throw;
 269            }
 10270        }
 271
 272        /// <summary> Deletes the specified local network gateway. </summary>
 273        /// <param name="resourceGroupName"> The name of the resource group. </param>
 274        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 275        /// <param name="cancellationToken"> The cancellation token to use. </param>
 276        public virtual async Task<LocalNetworkGatewaysDeleteOperation> StartDeleteAsync(string resourceGroupName, string
 277        {
 2278            if (resourceGroupName == null)
 279            {
 0280                throw new ArgumentNullException(nameof(resourceGroupName));
 281            }
 2282            if (localNetworkGatewayName == null)
 283            {
 0284                throw new ArgumentNullException(nameof(localNetworkGatewayName));
 285            }
 286
 2287            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartDelete");
 2288            scope.Start();
 289            try
 290            {
 2291                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, localNetworkGatewayName, cancella
 2292                return new LocalNetworkGatewaysDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq
 293            }
 0294            catch (Exception e)
 295            {
 0296                scope.Failed(e);
 0297                throw;
 298            }
 2299        }
 300
 301        /// <summary> Deletes the specified local network gateway. </summary>
 302        /// <param name="resourceGroupName"> The name of the resource group. </param>
 303        /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param>
 304        /// <param name="cancellationToken"> The cancellation token to use. </param>
 305        public virtual LocalNetworkGatewaysDeleteOperation StartDelete(string resourceGroupName, string localNetworkGate
 306        {
 2307            if (resourceGroupName == null)
 308            {
 0309                throw new ArgumentNullException(nameof(resourceGroupName));
 310            }
 2311            if (localNetworkGatewayName == null)
 312            {
 0313                throw new ArgumentNullException(nameof(localNetworkGatewayName));
 314            }
 315
 2316            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartDelete");
 2317            scope.Start();
 318            try
 319            {
 2320                var originalResponse = RestClient.Delete(resourceGroupName, localNetworkGatewayName, cancellationToken);
 2321                return new LocalNetworkGatewaysDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq
 322            }
 0323            catch (Exception e)
 324            {
 0325                scope.Failed(e);
 0326                throw;
 327            }
 2328        }
 329    }
 330}