< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
GetAsync()-0%100%
Get(...)-0%100%
ListAsync(...)-0%0%
<ListAsync()-0%100%
<ListAsync()-0%100%
List(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\HubVirtualNetworkConnectionsOperations.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 HubVirtualNetworkConnections service client. </summary>
 19    public partial class HubVirtualNetworkConnectionsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal HubVirtualNetworkConnectionsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of HubVirtualNetworkConnectionsOperations for mocking. </summary>
 025        protected HubVirtualNetworkConnectionsOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of HubVirtualNetworkConnectionsOperations. </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 HubVirtualNetworkConnectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, stri
 34        {
 035            RestClient = new HubVirtualNetworkConnectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, end
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Retrieves the details of a HubVirtualNetworkConnection. </summary>
 41        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 42        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 43        /// <param name="connectionName"> The name of the vpn connection. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<HubVirtualNetworkConnection>> GetAsync(string resourceGroupName, string virtu
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionsOperations.Get");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.GetAsync(resourceGroupName, virtualHubName, connectionName, cancellationToken).C
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Retrieves the details of a HubVirtualNetworkConnection. </summary>
 61        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 62        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 63        /// <param name="connectionName"> The name of the vpn connection. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<HubVirtualNetworkConnection> Get(string resourceGroupName, string virtualHubName, string
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionsOperations.Get");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Get(resourceGroupName, virtualHubName, connectionName, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Retrieves the details of all HubVirtualNetworkConnections. </summary>
 81        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 82        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 83        /// <param name="cancellationToken"> The cancellation token to use. </param>
 84        public virtual AsyncPageable<HubVirtualNetworkConnection> ListAsync(string resourceGroupName, string virtualHubN
 85        {
 086            if (resourceGroupName == null)
 87            {
 088                throw new ArgumentNullException(nameof(resourceGroupName));
 89            }
 090            if (virtualHubName == null)
 91            {
 092                throw new ArgumentNullException(nameof(virtualHubName));
 93            }
 94
 95            async Task<Page<HubVirtualNetworkConnection>> FirstPageFunc(int? pageSizeHint)
 96            {
 097                using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionsOperations.List");
 098                scope.Start();
 99                try
 100                {
 0101                    var response = await RestClient.ListAsync(resourceGroupName, virtualHubName, cancellationToken).Conf
 0102                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 103                }
 0104                catch (Exception e)
 105                {
 0106                    scope.Failed(e);
 0107                    throw;
 108                }
 0109            }
 110            async Task<Page<HubVirtualNetworkConnection>> NextPageFunc(string nextLink, int? pageSizeHint)
 111            {
 0112                using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionsOperations.List");
 0113                scope.Start();
 114                try
 115                {
 0116                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, virtualHubName, cance
 0117                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 118                }
 0119                catch (Exception e)
 120                {
 0121                    scope.Failed(e);
 0122                    throw;
 123                }
 0124            }
 0125            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 126        }
 127
 128        /// <summary> Retrieves the details of all HubVirtualNetworkConnections. </summary>
 129        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 130        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 131        /// <param name="cancellationToken"> The cancellation token to use. </param>
 132        public virtual Pageable<HubVirtualNetworkConnection> List(string resourceGroupName, string virtualHubName, Cance
 133        {
 0134            if (resourceGroupName == null)
 135            {
 0136                throw new ArgumentNullException(nameof(resourceGroupName));
 137            }
 0138            if (virtualHubName == null)
 139            {
 0140                throw new ArgumentNullException(nameof(virtualHubName));
 141            }
 142
 143            Page<HubVirtualNetworkConnection> FirstPageFunc(int? pageSizeHint)
 144            {
 0145                using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionsOperations.List");
 0146                scope.Start();
 147                try
 148                {
 0149                    var response = RestClient.List(resourceGroupName, virtualHubName, cancellationToken);
 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            }
 158            Page<HubVirtualNetworkConnection> NextPageFunc(string nextLink, int? pageSizeHint)
 159            {
 0160                using var scope = _clientDiagnostics.CreateScope("HubVirtualNetworkConnectionsOperations.List");
 0161                scope.Start();
 162                try
 163                {
 0164                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, virtualHubName, cancellationToke
 0165                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 166                }
 0167                catch (Exception e)
 168                {
 0169                    scope.Failed(e);
 0170                    throw;
 171                }
 0172            }
 0173            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 174        }
 175    }
 176}