< Summary

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

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\VpnGatewaysOperations.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 VpnGateways service client. </summary>
 19    public partial class VpnGatewaysOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal VpnGatewaysRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of VpnGatewaysOperations for mocking. </summary>
 025        protected VpnGatewaysOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of VpnGatewaysOperations. </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 VpnGatewaysOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId
 34        {
 035            RestClient = new VpnGatewaysRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Retrieves the details of a virtual wan vpn gateway. </summary>
 41        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 42        /// <param name="gatewayName"> The name of the gateway. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<VpnGateway>> GetAsync(string resourceGroupName, string gatewayName, Cancellat
 45        {
 046            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.Get");
 047            scope.Start();
 48            try
 49            {
 050                return await RestClient.GetAsync(resourceGroupName, gatewayName, cancellationToken).ConfigureAwait(false
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 057        }
 58
 59        /// <summary> Retrieves the details of a virtual wan vpn gateway. </summary>
 60        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 61        /// <param name="gatewayName"> The name of the gateway. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<VpnGateway> Get(string resourceGroupName, string gatewayName, CancellationToken cancella
 64        {
 065            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.Get");
 066            scope.Start();
 67            try
 68            {
 069                return RestClient.Get(resourceGroupName, gatewayName, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 076        }
 77
 78        /// <summary> Updates virtual wan vpn gateway tags. </summary>
 79        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 80        /// <param name="gatewayName"> The name of the gateway. </param>
 81        /// <param name="vpnGatewayParameters"> Parameters supplied to update a virtual wan vpn gateway tags. </param>
 82        /// <param name="cancellationToken"> The cancellation token to use. </param>
 83        public virtual async Task<Response<VpnGateway>> UpdateTagsAsync(string resourceGroupName, string gatewayName, Ta
 84        {
 085            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.UpdateTags");
 086            scope.Start();
 87            try
 88            {
 089                return await RestClient.UpdateTagsAsync(resourceGroupName, gatewayName, vpnGatewayParameters, cancellati
 90            }
 091            catch (Exception e)
 92            {
 093                scope.Failed(e);
 094                throw;
 95            }
 096        }
 97
 98        /// <summary> Updates virtual wan vpn gateway tags. </summary>
 99        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 100        /// <param name="gatewayName"> The name of the gateway. </param>
 101        /// <param name="vpnGatewayParameters"> Parameters supplied to update a virtual wan vpn gateway tags. </param>
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<VpnGateway> UpdateTags(string resourceGroupName, string gatewayName, TagsObject vpnGatew
 104        {
 0105            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.UpdateTags");
 0106            scope.Start();
 107            try
 108            {
 0109                return RestClient.UpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 0116        }
 117
 118        /// <summary> Lists all the VpnGateways in a resource group. </summary>
 119        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public virtual AsyncPageable<VpnGateway> ListByResourceGroupAsync(string resourceGroupName, CancellationToken ca
 122        {
 0123            if (resourceGroupName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(resourceGroupName));
 126            }
 127
 128            async Task<Page<VpnGateway>> FirstPageFunc(int? pageSizeHint)
 129            {
 0130                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.ListByResourceGroup");
 0131                scope.Start();
 132                try
 133                {
 0134                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0135                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 136                }
 0137                catch (Exception e)
 138                {
 0139                    scope.Failed(e);
 0140                    throw;
 141                }
 0142            }
 143            async Task<Page<VpnGateway>> NextPageFunc(string nextLink, int? pageSizeHint)
 144            {
 0145                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.ListByResourceGroup");
 0146                scope.Start();
 147                try
 148                {
 0149                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 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            }
 0158            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 159        }
 160
 161        /// <summary> Lists all the VpnGateways in a resource group. </summary>
 162        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 163        /// <param name="cancellationToken"> The cancellation token to use. </param>
 164        public virtual Pageable<VpnGateway> ListByResourceGroup(string resourceGroupName, CancellationToken cancellation
 165        {
 0166            if (resourceGroupName == null)
 167            {
 0168                throw new ArgumentNullException(nameof(resourceGroupName));
 169            }
 170
 171            Page<VpnGateway> FirstPageFunc(int? pageSizeHint)
 172            {
 0173                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.ListByResourceGroup");
 0174                scope.Start();
 175                try
 176                {
 0177                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0178                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 179                }
 0180                catch (Exception e)
 181                {
 0182                    scope.Failed(e);
 0183                    throw;
 184                }
 0185            }
 186            Page<VpnGateway> NextPageFunc(string nextLink, int? pageSizeHint)
 187            {
 0188                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.ListByResourceGroup");
 0189                scope.Start();
 190                try
 191                {
 0192                    var response = RestClient.ListByResourceGroupNextPage(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            }
 0201            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 202        }
 203
 204        /// <summary> Lists all the VpnGateways in a subscription. </summary>
 205        /// <param name="cancellationToken"> The cancellation token to use. </param>
 206        public virtual AsyncPageable<VpnGateway> ListAsync(CancellationToken cancellationToken = default)
 207        {
 208            async Task<Page<VpnGateway>> FirstPageFunc(int? pageSizeHint)
 209            {
 0210                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.List");
 0211                scope.Start();
 212                try
 213                {
 0214                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 0215                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 216                }
 0217                catch (Exception e)
 218                {
 0219                    scope.Failed(e);
 0220                    throw;
 221                }
 0222            }
 223            async Task<Page<VpnGateway>> NextPageFunc(string nextLink, int? pageSizeHint)
 224            {
 0225                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.List");
 0226                scope.Start();
 227                try
 228                {
 0229                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0230                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 231                }
 0232                catch (Exception e)
 233                {
 0234                    scope.Failed(e);
 0235                    throw;
 236                }
 0237            }
 0238            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 239        }
 240
 241        /// <summary> Lists all the VpnGateways in a subscription. </summary>
 242        /// <param name="cancellationToken"> The cancellation token to use. </param>
 243        public virtual Pageable<VpnGateway> List(CancellationToken cancellationToken = default)
 244        {
 245            Page<VpnGateway> FirstPageFunc(int? pageSizeHint)
 246            {
 0247                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.List");
 0248                scope.Start();
 249                try
 250                {
 0251                    var response = RestClient.List(cancellationToken);
 0252                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 253                }
 0254                catch (Exception e)
 255                {
 0256                    scope.Failed(e);
 0257                    throw;
 258                }
 0259            }
 260            Page<VpnGateway> NextPageFunc(string nextLink, int? pageSizeHint)
 261            {
 0262                using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.List");
 0263                scope.Start();
 264                try
 265                {
 0266                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0267                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 268                }
 0269                catch (Exception e)
 270                {
 0271                    scope.Failed(e);
 0272                    throw;
 273                }
 0274            }
 0275            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 276        }
 277
 278        /// <summary> Creates a virtual wan vpn gateway if it doesn&apos;t exist else updates the existing gateway. </su
 279        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 280        /// <param name="gatewayName"> The name of the gateway. </param>
 281        /// <param name="vpnGatewayParameters"> Parameters supplied to create or Update a virtual wan vpn gateway. </par
 282        /// <param name="cancellationToken"> The cancellation token to use. </param>
 283        public virtual async Task<VpnGatewaysCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName,
 284        {
 0285            if (resourceGroupName == null)
 286            {
 0287                throw new ArgumentNullException(nameof(resourceGroupName));
 288            }
 0289            if (gatewayName == null)
 290            {
 0291                throw new ArgumentNullException(nameof(gatewayName));
 292            }
 0293            if (vpnGatewayParameters == null)
 294            {
 0295                throw new ArgumentNullException(nameof(vpnGatewayParameters));
 296            }
 297
 0298            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.StartCreateOrUpdate");
 0299            scope.Start();
 300            try
 301            {
 0302                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, gatewayName, vpnGatewayPa
 0303                return new VpnGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUp
 304            }
 0305            catch (Exception e)
 306            {
 0307                scope.Failed(e);
 0308                throw;
 309            }
 0310        }
 311
 312        /// <summary> Creates a virtual wan vpn gateway if it doesn&apos;t exist else updates the existing gateway. </su
 313        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 314        /// <param name="gatewayName"> The name of the gateway. </param>
 315        /// <param name="vpnGatewayParameters"> Parameters supplied to create or Update a virtual wan vpn gateway. </par
 316        /// <param name="cancellationToken"> The cancellation token to use. </param>
 317        public virtual VpnGatewaysCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string gatewayNa
 318        {
 0319            if (resourceGroupName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(resourceGroupName));
 322            }
 0323            if (gatewayName == null)
 324            {
 0325                throw new ArgumentNullException(nameof(gatewayName));
 326            }
 0327            if (vpnGatewayParameters == null)
 328            {
 0329                throw new ArgumentNullException(nameof(vpnGatewayParameters));
 330            }
 331
 0332            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.StartCreateOrUpdate");
 0333            scope.Start();
 334            try
 335            {
 0336                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, c
 0337                return new VpnGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUp
 338            }
 0339            catch (Exception e)
 340            {
 0341                scope.Failed(e);
 0342                throw;
 343            }
 0344        }
 345
 346        /// <summary> Deletes a virtual wan vpn gateway. </summary>
 347        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 348        /// <param name="gatewayName"> The name of the gateway. </param>
 349        /// <param name="cancellationToken"> The cancellation token to use. </param>
 350        public virtual async Task<VpnGatewaysDeleteOperation> StartDeleteAsync(string resourceGroupName, string gatewayN
 351        {
 0352            if (resourceGroupName == null)
 353            {
 0354                throw new ArgumentNullException(nameof(resourceGroupName));
 355            }
 0356            if (gatewayName == null)
 357            {
 0358                throw new ArgumentNullException(nameof(gatewayName));
 359            }
 360
 0361            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.StartDelete");
 0362            scope.Start();
 363            try
 364            {
 0365                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, gatewayName, cancellationToken).C
 0366                return new VpnGatewaysDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(reso
 367            }
 0368            catch (Exception e)
 369            {
 0370                scope.Failed(e);
 0371                throw;
 372            }
 0373        }
 374
 375        /// <summary> Deletes a virtual wan vpn gateway. </summary>
 376        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 377        /// <param name="gatewayName"> The name of the gateway. </param>
 378        /// <param name="cancellationToken"> The cancellation token to use. </param>
 379        public virtual VpnGatewaysDeleteOperation StartDelete(string resourceGroupName, string gatewayName, Cancellation
 380        {
 0381            if (resourceGroupName == null)
 382            {
 0383                throw new ArgumentNullException(nameof(resourceGroupName));
 384            }
 0385            if (gatewayName == null)
 386            {
 0387                throw new ArgumentNullException(nameof(gatewayName));
 388            }
 389
 0390            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.StartDelete");
 0391            scope.Start();
 392            try
 393            {
 0394                var originalResponse = RestClient.Delete(resourceGroupName, gatewayName, cancellationToken);
 0395                return new VpnGatewaysDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(reso
 396            }
 0397            catch (Exception e)
 398            {
 0399                scope.Failed(e);
 0400                throw;
 401            }
 0402        }
 403
 404        /// <summary> Resets the primary of the vpn gateway in the specified resource group. </summary>
 405        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 406        /// <param name="gatewayName"> The name of the gateway. </param>
 407        /// <param name="cancellationToken"> The cancellation token to use. </param>
 408        public virtual async Task<VpnGatewaysResetOperation> StartResetAsync(string resourceGroupName, string gatewayNam
 409        {
 0410            if (resourceGroupName == null)
 411            {
 0412                throw new ArgumentNullException(nameof(resourceGroupName));
 413            }
 0414            if (gatewayName == null)
 415            {
 0416                throw new ArgumentNullException(nameof(gatewayName));
 417            }
 418
 0419            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.StartReset");
 0420            scope.Start();
 421            try
 422            {
 0423                var originalResponse = await RestClient.ResetAsync(resourceGroupName, gatewayName, cancellationToken).Co
 0424                return new VpnGatewaysResetOperation(_clientDiagnostics, _pipeline, RestClient.CreateResetRequest(resour
 425            }
 0426            catch (Exception e)
 427            {
 0428                scope.Failed(e);
 0429                throw;
 430            }
 0431        }
 432
 433        /// <summary> Resets the primary of the vpn gateway in the specified resource group. </summary>
 434        /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param>
 435        /// <param name="gatewayName"> The name of the gateway. </param>
 436        /// <param name="cancellationToken"> The cancellation token to use. </param>
 437        public virtual VpnGatewaysResetOperation StartReset(string resourceGroupName, string gatewayName, CancellationTo
 438        {
 0439            if (resourceGroupName == null)
 440            {
 0441                throw new ArgumentNullException(nameof(resourceGroupName));
 442            }
 0443            if (gatewayName == null)
 444            {
 0445                throw new ArgumentNullException(nameof(gatewayName));
 446            }
 447
 0448            using var scope = _clientDiagnostics.CreateScope("VpnGatewaysOperations.StartReset");
 0449            scope.Start();
 450            try
 451            {
 0452                var originalResponse = RestClient.Reset(resourceGroupName, gatewayName, cancellationToken);
 0453                return new VpnGatewaysResetOperation(_clientDiagnostics, _pipeline, RestClient.CreateResetRequest(resour
 454            }
 0455            catch (Exception e)
 456            {
 0457                scope.Failed(e);
 0458                throw;
 459            }
 0460        }
 461    }
 462}