< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\VpnServerConfigurationsAssociatedWithVirtualWanRestOperations.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;
 14
 15namespace Azure.ResourceManager.Network
 16{
 17    internal partial class VpnServerConfigurationsAssociatedWithVirtualWanRestOperations
 18    {
 19        private string subscriptionId;
 20        private Uri endpoint;
 21        private ClientDiagnostics _clientDiagnostics;
 22        private HttpPipeline _pipeline;
 23
 24        /// <summary> Initializes a new instance of VpnServerConfigurationsAssociatedWithVirtualWanRestOperations. </sum
 25        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 26        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 27        /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc
 28        /// <param name="endpoint"> server parameter. </param>
 29        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 030        public VpnServerConfigurationsAssociatedWithVirtualWanRestOperations(ClientDiagnostics clientDiagnostics, HttpPi
 31        {
 032            if (subscriptionId == null)
 33            {
 034                throw new ArgumentNullException(nameof(subscriptionId));
 35            }
 036            endpoint ??= new Uri("https://management.azure.com");
 37
 038            this.subscriptionId = subscriptionId;
 039            this.endpoint = endpoint;
 040            _clientDiagnostics = clientDiagnostics;
 041            _pipeline = pipeline;
 042        }
 43
 44        internal HttpMessage CreateListRequest(string resourceGroupName, string virtualWANName)
 45        {
 046            var message = _pipeline.CreateMessage();
 047            var request = message.Request;
 048            request.Method = RequestMethod.Post;
 049            var uri = new RawRequestUriBuilder();
 050            uri.Reset(endpoint);
 051            uri.AppendPath("/subscriptions/", false);
 052            uri.AppendPath(subscriptionId, true);
 053            uri.AppendPath("/resourceGroups/", false);
 054            uri.AppendPath(resourceGroupName, true);
 055            uri.AppendPath("/providers/Microsoft.Network/virtualWans/", false);
 056            uri.AppendPath(virtualWANName, true);
 057            uri.AppendPath("/vpnServerConfigurations", false);
 058            uri.AppendQuery("api-version", "2020-04-01", true);
 059            request.Uri = uri;
 060            return message;
 61        }
 62
 63        /// <summary> Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. </summa
 64        /// <param name="resourceGroupName"> The resource group name. </param>
 65        /// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed.
 66        /// <param name="cancellationToken"> The cancellation token to use. </param>
 67        public async Task<Response> ListAsync(string resourceGroupName, string virtualWANName, CancellationToken cancell
 68        {
 069            if (resourceGroupName == null)
 70            {
 071                throw new ArgumentNullException(nameof(resourceGroupName));
 72            }
 073            if (virtualWANName == null)
 74            {
 075                throw new ArgumentNullException(nameof(virtualWANName));
 76            }
 77
 078            using var message = CreateListRequest(resourceGroupName, virtualWANName);
 079            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 080            switch (message.Response.Status)
 81            {
 82                case 200:
 83                case 202:
 084                    return message.Response;
 85                default:
 086                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 87            }
 088        }
 89
 90        /// <summary> Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. </summa
 91        /// <param name="resourceGroupName"> The resource group name. </param>
 92        /// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed.
 93        /// <param name="cancellationToken"> The cancellation token to use. </param>
 94        public Response List(string resourceGroupName, string virtualWANName, CancellationToken cancellationToken = defa
 95        {
 096            if (resourceGroupName == null)
 97            {
 098                throw new ArgumentNullException(nameof(resourceGroupName));
 99            }
 0100            if (virtualWANName == null)
 101            {
 0102                throw new ArgumentNullException(nameof(virtualWANName));
 103            }
 104
 0105            using var message = CreateListRequest(resourceGroupName, virtualWANName);
 0106            _pipeline.Send(message, cancellationToken);
 0107            switch (message.Response.Status)
 108            {
 109                case 200:
 110                case 202:
 0111                    return message.Response;
 112                default:
 0113                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 114            }
 0115        }
 116    }
 117}