< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateDownloadRequest(...)-0%100%
DownloadAsync()-0%0%
Download(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\VpnSitesConfigurationRestOperations.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    internal partial class VpnSitesConfigurationRestOperations
 19    {
 20        private string subscriptionId;
 21        private Uri endpoint;
 22        private ClientDiagnostics _clientDiagnostics;
 23        private HttpPipeline _pipeline;
 24
 25        /// <summary> Initializes a new instance of VpnSitesConfigurationRestOperations. </summary>
 26        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 27        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 28        /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc
 29        /// <param name="endpoint"> server parameter. </param>
 30        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 031        public VpnSitesConfigurationRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string su
 32        {
 033            if (subscriptionId == null)
 34            {
 035                throw new ArgumentNullException(nameof(subscriptionId));
 36            }
 037            endpoint ??= new Uri("https://management.azure.com");
 38
 039            this.subscriptionId = subscriptionId;
 040            this.endpoint = endpoint;
 041            _clientDiagnostics = clientDiagnostics;
 042            _pipeline = pipeline;
 043        }
 44
 45        internal HttpMessage CreateDownloadRequest(string resourceGroupName, string virtualWANName, GetVpnSitesConfigura
 46        {
 047            var message = _pipeline.CreateMessage();
 048            var request0 = message.Request;
 049            request0.Method = RequestMethod.Post;
 050            var uri = new RawRequestUriBuilder();
 051            uri.Reset(endpoint);
 052            uri.AppendPath("/subscriptions/", false);
 053            uri.AppendPath(subscriptionId, true);
 054            uri.AppendPath("/resourceGroups/", false);
 055            uri.AppendPath(resourceGroupName, true);
 056            uri.AppendPath("/providers/Microsoft.Network/virtualWans/", false);
 057            uri.AppendPath(virtualWANName, true);
 058            uri.AppendPath("/vpnConfiguration", false);
 059            uri.AppendQuery("api-version", "2020-04-01", true);
 060            request0.Uri = uri;
 061            request0.Headers.Add("Content-Type", "application/json");
 062            var content = new Utf8JsonRequestContent();
 063            content.JsonWriter.WriteObjectValue(request);
 064            request0.Content = content;
 065            return message;
 66        }
 67
 68        /// <summary> Gives the sas-url to download the configurations for vpn-sites in a resource group. </summary>
 69        /// <param name="resourceGroupName"> The resource group name. </param>
 70        /// <param name="virtualWANName"> The name of the VirtualWAN for which configuration of all vpn-sites is needed.
 71        /// <param name="request"> Parameters supplied to download vpn-sites configuration. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response> DownloadAsync(string resourceGroupName, string virtualWANName, GetVpnSitesConfigurat
 74        {
 075            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 079            if (virtualWANName == null)
 80            {
 081                throw new ArgumentNullException(nameof(virtualWANName));
 82            }
 083            if (request == null)
 84            {
 085                throw new ArgumentNullException(nameof(request));
 86            }
 87
 088            using var message = CreateDownloadRequest(resourceGroupName, virtualWANName, request);
 089            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 090            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 202:
 094                    return message.Response;
 95                default:
 096                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 97            }
 098        }
 99
 100        /// <summary> Gives the sas-url to download the configurations for vpn-sites in a resource group. </summary>
 101        /// <param name="resourceGroupName"> The resource group name. </param>
 102        /// <param name="virtualWANName"> The name of the VirtualWAN for which configuration of all vpn-sites is needed.
 103        /// <param name="request"> Parameters supplied to download vpn-sites configuration. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public Response Download(string resourceGroupName, string virtualWANName, GetVpnSitesConfigurationRequest reques
 106        {
 0107            if (resourceGroupName == null)
 108            {
 0109                throw new ArgumentNullException(nameof(resourceGroupName));
 110            }
 0111            if (virtualWANName == null)
 112            {
 0113                throw new ArgumentNullException(nameof(virtualWANName));
 114            }
 0115            if (request == null)
 116            {
 0117                throw new ArgumentNullException(nameof(request));
 118            }
 119
 0120            using var message = CreateDownloadRequest(resourceGroupName, virtualWANName, request);
 0121            _pipeline.Send(message, cancellationToken);
 0122            switch (message.Response.Status)
 123            {
 124                case 200:
 125                case 202:
 0126                    return message.Response;
 127                default:
 0128                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 129            }
 0130        }
 131    }
 132}