< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateListByVpnSiteRequest(...)-0%100%
ListByVpnSiteAsync()-0%0%
ListByVpnSite(...)-0%0%
CreateListByVpnSiteNextPageRequest(...)-0%100%
ListByVpnSiteNextPageAsync()-0%0%
ListByVpnSiteNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\VpnSiteLinksRestOperations.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.Text.Json;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Core;
 14using Azure.Core.Pipeline;
 15using Azure.ResourceManager.Network.Models;
 16
 17namespace Azure.ResourceManager.Network
 18{
 19    internal partial class VpnSiteLinksRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of VpnSiteLinksRestOperations. </summary>
 27        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 28        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 29        /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 032        public VpnSiteLinksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio
 33        {
 034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 038            endpoint ??= new Uri("https://management.azure.com");
 39
 040            this.subscriptionId = subscriptionId;
 041            this.endpoint = endpoint;
 042            _clientDiagnostics = clientDiagnostics;
 043            _pipeline = pipeline;
 044        }
 45
 46        internal HttpMessage CreateGetRequest(string resourceGroupName, string vpnSiteName, string vpnSiteLinkName)
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Get;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/resourceGroups/", false);
 056            uri.AppendPath(resourceGroupName, true);
 057            uri.AppendPath("/providers/Microsoft.Network/vpnSites/", false);
 058            uri.AppendPath(vpnSiteName, true);
 059            uri.AppendPath("/vpnSiteLinks/", false);
 060            uri.AppendPath(vpnSiteLinkName, true);
 061            uri.AppendQuery("api-version", "2020-04-01", true);
 062            request.Uri = uri;
 063            return message;
 64        }
 65
 66        /// <summary> Retrieves the details of a VPN site link. </summary>
 67        /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param>
 68        /// <param name="vpnSiteName"> The name of the VpnSite. </param>
 69        /// <param name="vpnSiteLinkName"> The name of the VpnSiteLink being retrieved. </param>
 70        /// <param name="cancellationToken"> The cancellation token to use. </param>
 71        public async Task<Response<VpnSiteLink>> GetAsync(string resourceGroupName, string vpnSiteName, string vpnSiteLi
 72        {
 073            if (resourceGroupName == null)
 74            {
 075                throw new ArgumentNullException(nameof(resourceGroupName));
 76            }
 077            if (vpnSiteName == null)
 78            {
 079                throw new ArgumentNullException(nameof(vpnSiteName));
 80            }
 081            if (vpnSiteLinkName == null)
 82            {
 083                throw new ArgumentNullException(nameof(vpnSiteLinkName));
 84            }
 85
 086            using var message = CreateGetRequest(resourceGroupName, vpnSiteName, vpnSiteLinkName);
 087            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 088            switch (message.Response.Status)
 89            {
 90                case 200:
 91                    {
 092                        VpnSiteLink value = default;
 093                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 094                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 95                        {
 096                            value = null;
 97                        }
 98                        else
 99                        {
 0100                            value = VpnSiteLink.DeserializeVpnSiteLink(document.RootElement);
 101                        }
 0102                        return Response.FromValue(value, message.Response);
 103                    }
 104                default:
 0105                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 106            }
 0107        }
 108
 109        /// <summary> Retrieves the details of a VPN site link. </summary>
 110        /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param>
 111        /// <param name="vpnSiteName"> The name of the VpnSite. </param>
 112        /// <param name="vpnSiteLinkName"> The name of the VpnSiteLink being retrieved. </param>
 113        /// <param name="cancellationToken"> The cancellation token to use. </param>
 114        public Response<VpnSiteLink> Get(string resourceGroupName, string vpnSiteName, string vpnSiteLinkName, Cancellat
 115        {
 0116            if (resourceGroupName == null)
 117            {
 0118                throw new ArgumentNullException(nameof(resourceGroupName));
 119            }
 0120            if (vpnSiteName == null)
 121            {
 0122                throw new ArgumentNullException(nameof(vpnSiteName));
 123            }
 0124            if (vpnSiteLinkName == null)
 125            {
 0126                throw new ArgumentNullException(nameof(vpnSiteLinkName));
 127            }
 128
 0129            using var message = CreateGetRequest(resourceGroupName, vpnSiteName, vpnSiteLinkName);
 0130            _pipeline.Send(message, cancellationToken);
 0131            switch (message.Response.Status)
 132            {
 133                case 200:
 134                    {
 0135                        VpnSiteLink value = default;
 0136                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0137                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 138                        {
 0139                            value = null;
 140                        }
 141                        else
 142                        {
 0143                            value = VpnSiteLink.DeserializeVpnSiteLink(document.RootElement);
 144                        }
 0145                        return Response.FromValue(value, message.Response);
 146                    }
 147                default:
 0148                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 149            }
 0150        }
 151
 152        internal HttpMessage CreateListByVpnSiteRequest(string resourceGroupName, string vpnSiteName)
 153        {
 0154            var message = _pipeline.CreateMessage();
 0155            var request = message.Request;
 0156            request.Method = RequestMethod.Get;
 0157            var uri = new RawRequestUriBuilder();
 0158            uri.Reset(endpoint);
 0159            uri.AppendPath("/subscriptions/", false);
 0160            uri.AppendPath(subscriptionId, true);
 0161            uri.AppendPath("/resourceGroups/", false);
 0162            uri.AppendPath(resourceGroupName, true);
 0163            uri.AppendPath("/providers/Microsoft.Network/vpnSites/", false);
 0164            uri.AppendPath(vpnSiteName, true);
 0165            uri.AppendPath("/vpnSiteLinks", false);
 0166            uri.AppendQuery("api-version", "2020-04-01", true);
 0167            request.Uri = uri;
 0168            return message;
 169        }
 170
 171        /// <summary> Lists all the vpnSiteLinks in a resource group for a vpn site. </summary>
 172        /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param>
 173        /// <param name="vpnSiteName"> The name of the VpnSite. </param>
 174        /// <param name="cancellationToken"> The cancellation token to use. </param>
 175        public async Task<Response<ListVpnSiteLinksResult>> ListByVpnSiteAsync(string resourceGroupName, string vpnSiteN
 176        {
 0177            if (resourceGroupName == null)
 178            {
 0179                throw new ArgumentNullException(nameof(resourceGroupName));
 180            }
 0181            if (vpnSiteName == null)
 182            {
 0183                throw new ArgumentNullException(nameof(vpnSiteName));
 184            }
 185
 0186            using var message = CreateListByVpnSiteRequest(resourceGroupName, vpnSiteName);
 0187            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0188            switch (message.Response.Status)
 189            {
 190                case 200:
 191                    {
 0192                        ListVpnSiteLinksResult value = default;
 0193                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0194                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 195                        {
 0196                            value = null;
 197                        }
 198                        else
 199                        {
 0200                            value = ListVpnSiteLinksResult.DeserializeListVpnSiteLinksResult(document.RootElement);
 201                        }
 0202                        return Response.FromValue(value, message.Response);
 203                    }
 204                default:
 0205                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 206            }
 0207        }
 208
 209        /// <summary> Lists all the vpnSiteLinks in a resource group for a vpn site. </summary>
 210        /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param>
 211        /// <param name="vpnSiteName"> The name of the VpnSite. </param>
 212        /// <param name="cancellationToken"> The cancellation token to use. </param>
 213        public Response<ListVpnSiteLinksResult> ListByVpnSite(string resourceGroupName, string vpnSiteName, Cancellation
 214        {
 0215            if (resourceGroupName == null)
 216            {
 0217                throw new ArgumentNullException(nameof(resourceGroupName));
 218            }
 0219            if (vpnSiteName == null)
 220            {
 0221                throw new ArgumentNullException(nameof(vpnSiteName));
 222            }
 223
 0224            using var message = CreateListByVpnSiteRequest(resourceGroupName, vpnSiteName);
 0225            _pipeline.Send(message, cancellationToken);
 0226            switch (message.Response.Status)
 227            {
 228                case 200:
 229                    {
 0230                        ListVpnSiteLinksResult value = default;
 0231                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0232                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 233                        {
 0234                            value = null;
 235                        }
 236                        else
 237                        {
 0238                            value = ListVpnSiteLinksResult.DeserializeListVpnSiteLinksResult(document.RootElement);
 239                        }
 0240                        return Response.FromValue(value, message.Response);
 241                    }
 242                default:
 0243                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 244            }
 0245        }
 246
 247        internal HttpMessage CreateListByVpnSiteNextPageRequest(string nextLink, string resourceGroupName, string vpnSit
 248        {
 0249            var message = _pipeline.CreateMessage();
 0250            var request = message.Request;
 0251            request.Method = RequestMethod.Get;
 0252            var uri = new RawRequestUriBuilder();
 0253            uri.Reset(endpoint);
 0254            uri.AppendRawNextLink(nextLink, false);
 0255            request.Uri = uri;
 0256            return message;
 257        }
 258
 259        /// <summary> Lists all the vpnSiteLinks in a resource group for a vpn site. </summary>
 260        /// <param name="nextLink"> The URL to the next page of results. </param>
 261        /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param>
 262        /// <param name="vpnSiteName"> The name of the VpnSite. </param>
 263        /// <param name="cancellationToken"> The cancellation token to use. </param>
 264        public async Task<Response<ListVpnSiteLinksResult>> ListByVpnSiteNextPageAsync(string nextLink, string resourceG
 265        {
 0266            if (nextLink == null)
 267            {
 0268                throw new ArgumentNullException(nameof(nextLink));
 269            }
 0270            if (resourceGroupName == null)
 271            {
 0272                throw new ArgumentNullException(nameof(resourceGroupName));
 273            }
 0274            if (vpnSiteName == null)
 275            {
 0276                throw new ArgumentNullException(nameof(vpnSiteName));
 277            }
 278
 0279            using var message = CreateListByVpnSiteNextPageRequest(nextLink, resourceGroupName, vpnSiteName);
 0280            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0281            switch (message.Response.Status)
 282            {
 283                case 200:
 284                    {
 0285                        ListVpnSiteLinksResult value = default;
 0286                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0287                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 288                        {
 0289                            value = null;
 290                        }
 291                        else
 292                        {
 0293                            value = ListVpnSiteLinksResult.DeserializeListVpnSiteLinksResult(document.RootElement);
 294                        }
 0295                        return Response.FromValue(value, message.Response);
 296                    }
 297                default:
 0298                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 299            }
 0300        }
 301
 302        /// <summary> Lists all the vpnSiteLinks in a resource group for a vpn site. </summary>
 303        /// <param name="nextLink"> The URL to the next page of results. </param>
 304        /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param>
 305        /// <param name="vpnSiteName"> The name of the VpnSite. </param>
 306        /// <param name="cancellationToken"> The cancellation token to use. </param>
 307        public Response<ListVpnSiteLinksResult> ListByVpnSiteNextPage(string nextLink, string resourceGroupName, string 
 308        {
 0309            if (nextLink == null)
 310            {
 0311                throw new ArgumentNullException(nameof(nextLink));
 312            }
 0313            if (resourceGroupName == null)
 314            {
 0315                throw new ArgumentNullException(nameof(resourceGroupName));
 316            }
 0317            if (vpnSiteName == null)
 318            {
 0319                throw new ArgumentNullException(nameof(vpnSiteName));
 320            }
 321
 0322            using var message = CreateListByVpnSiteNextPageRequest(nextLink, resourceGroupName, vpnSiteName);
 0323            _pipeline.Send(message, cancellationToken);
 0324            switch (message.Response.Status)
 325            {
 326                case 200:
 327                    {
 0328                        ListVpnSiteLinksResult value = default;
 0329                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0330                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 331                        {
 0332                            value = null;
 333                        }
 334                        else
 335                        {
 0336                            value = ListVpnSiteLinksResult.DeserializeListVpnSiteLinksResult(document.RootElement);
 337                        }
 0338                        return Response.FromValue(value, message.Response);
 339                    }
 340                default:
 0341                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 342            }
 0343        }
 344    }
 345}