< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\PeerExpressRouteCircuitConnectionsRestOperations.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 PeerExpressRouteCircuitConnectionsRestOperations
 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 PeerExpressRouteCircuitConnectionsRestOperations. </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 PeerExpressRouteCircuitConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeli
 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 circuitName, string peeringName, string c
 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/expressRouteCircuits/", false);
 058            uri.AppendPath(circuitName, true);
 059            uri.AppendPath("/peerings/", false);
 060            uri.AppendPath(peeringName, true);
 061            uri.AppendPath("/peerConnections/", false);
 062            uri.AppendPath(connectionName, true);
 063            uri.AppendQuery("api-version", "2020-04-01", true);
 064            request.Uri = uri;
 065            return message;
 66        }
 67
 68        /// <summary> Gets the specified Peer Express Route Circuit Connection from the specified express route circuit.
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="circuitName"> The name of the express route circuit. </param>
 71        /// <param name="peeringName"> The name of the peering. </param>
 72        /// <param name="connectionName"> The name of the peer express route circuit connection. </param>
 73        /// <param name="cancellationToken"> The cancellation token to use. </param>
 74        public async Task<Response<PeerExpressRouteCircuitConnection>> GetAsync(string resourceGroupName, string circuit
 75        {
 076            if (resourceGroupName == null)
 77            {
 078                throw new ArgumentNullException(nameof(resourceGroupName));
 79            }
 080            if (circuitName == null)
 81            {
 082                throw new ArgumentNullException(nameof(circuitName));
 83            }
 084            if (peeringName == null)
 85            {
 086                throw new ArgumentNullException(nameof(peeringName));
 87            }
 088            if (connectionName == null)
 89            {
 090                throw new ArgumentNullException(nameof(connectionName));
 91            }
 92
 093            using var message = CreateGetRequest(resourceGroupName, circuitName, peeringName, connectionName);
 094            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 095            switch (message.Response.Status)
 96            {
 97                case 200:
 98                    {
 099                        PeerExpressRouteCircuitConnection value = default;
 0100                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0101                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 102                        {
 0103                            value = null;
 104                        }
 105                        else
 106                        {
 0107                            value = PeerExpressRouteCircuitConnection.DeserializePeerExpressRouteCircuitConnection(docum
 108                        }
 0109                        return Response.FromValue(value, message.Response);
 110                    }
 111                default:
 0112                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 113            }
 0114        }
 115
 116        /// <summary> Gets the specified Peer Express Route Circuit Connection from the specified express route circuit.
 117        /// <param name="resourceGroupName"> The name of the resource group. </param>
 118        /// <param name="circuitName"> The name of the express route circuit. </param>
 119        /// <param name="peeringName"> The name of the peering. </param>
 120        /// <param name="connectionName"> The name of the peer express route circuit connection. </param>
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public Response<PeerExpressRouteCircuitConnection> Get(string resourceGroupName, string circuitName, string peer
 123        {
 0124            if (resourceGroupName == null)
 125            {
 0126                throw new ArgumentNullException(nameof(resourceGroupName));
 127            }
 0128            if (circuitName == null)
 129            {
 0130                throw new ArgumentNullException(nameof(circuitName));
 131            }
 0132            if (peeringName == null)
 133            {
 0134                throw new ArgumentNullException(nameof(peeringName));
 135            }
 0136            if (connectionName == null)
 137            {
 0138                throw new ArgumentNullException(nameof(connectionName));
 139            }
 140
 0141            using var message = CreateGetRequest(resourceGroupName, circuitName, peeringName, connectionName);
 0142            _pipeline.Send(message, cancellationToken);
 0143            switch (message.Response.Status)
 144            {
 145                case 200:
 146                    {
 0147                        PeerExpressRouteCircuitConnection value = default;
 0148                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0149                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 150                        {
 0151                            value = null;
 152                        }
 153                        else
 154                        {
 0155                            value = PeerExpressRouteCircuitConnection.DeserializePeerExpressRouteCircuitConnection(docum
 156                        }
 0157                        return Response.FromValue(value, message.Response);
 158                    }
 159                default:
 0160                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 161            }
 0162        }
 163
 164        internal HttpMessage CreateListRequest(string resourceGroupName, string circuitName, string peeringName)
 165        {
 0166            var message = _pipeline.CreateMessage();
 0167            var request = message.Request;
 0168            request.Method = RequestMethod.Get;
 0169            var uri = new RawRequestUriBuilder();
 0170            uri.Reset(endpoint);
 0171            uri.AppendPath("/subscriptions/", false);
 0172            uri.AppendPath(subscriptionId, true);
 0173            uri.AppendPath("/resourceGroups/", false);
 0174            uri.AppendPath(resourceGroupName, true);
 0175            uri.AppendPath("/providers/Microsoft.Network/expressRouteCircuits/", false);
 0176            uri.AppendPath(circuitName, true);
 0177            uri.AppendPath("/peerings/", false);
 0178            uri.AppendPath(peeringName, true);
 0179            uri.AppendPath("/peerConnections", false);
 0180            uri.AppendQuery("api-version", "2020-04-01", true);
 0181            request.Uri = uri;
 0182            return message;
 183        }
 184
 185        /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu
 186        /// <param name="resourceGroupName"> The name of the resource group. </param>
 187        /// <param name="circuitName"> The name of the circuit. </param>
 188        /// <param name="peeringName"> The name of the peering. </param>
 189        /// <param name="cancellationToken"> The cancellation token to use. </param>
 190        public async Task<Response<PeerExpressRouteCircuitConnectionListResult>> ListAsync(string resourceGroupName, str
 191        {
 0192            if (resourceGroupName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(resourceGroupName));
 195            }
 0196            if (circuitName == null)
 197            {
 0198                throw new ArgumentNullException(nameof(circuitName));
 199            }
 0200            if (peeringName == null)
 201            {
 0202                throw new ArgumentNullException(nameof(peeringName));
 203            }
 204
 0205            using var message = CreateListRequest(resourceGroupName, circuitName, peeringName);
 0206            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0207            switch (message.Response.Status)
 208            {
 209                case 200:
 210                    {
 0211                        PeerExpressRouteCircuitConnectionListResult value = default;
 0212                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0213                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 214                        {
 0215                            value = null;
 216                        }
 217                        else
 218                        {
 0219                            value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec
 220                        }
 0221                        return Response.FromValue(value, message.Response);
 222                    }
 223                default:
 0224                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 225            }
 0226        }
 227
 228        /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu
 229        /// <param name="resourceGroupName"> The name of the resource group. </param>
 230        /// <param name="circuitName"> The name of the circuit. </param>
 231        /// <param name="peeringName"> The name of the peering. </param>
 232        /// <param name="cancellationToken"> The cancellation token to use. </param>
 233        public Response<PeerExpressRouteCircuitConnectionListResult> List(string resourceGroupName, string circuitName, 
 234        {
 0235            if (resourceGroupName == null)
 236            {
 0237                throw new ArgumentNullException(nameof(resourceGroupName));
 238            }
 0239            if (circuitName == null)
 240            {
 0241                throw new ArgumentNullException(nameof(circuitName));
 242            }
 0243            if (peeringName == null)
 244            {
 0245                throw new ArgumentNullException(nameof(peeringName));
 246            }
 247
 0248            using var message = CreateListRequest(resourceGroupName, circuitName, peeringName);
 0249            _pipeline.Send(message, cancellationToken);
 0250            switch (message.Response.Status)
 251            {
 252                case 200:
 253                    {
 0254                        PeerExpressRouteCircuitConnectionListResult value = default;
 0255                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0256                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 257                        {
 0258                            value = null;
 259                        }
 260                        else
 261                        {
 0262                            value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec
 263                        }
 0264                        return Response.FromValue(value, message.Response);
 265                    }
 266                default:
 0267                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 268            }
 0269        }
 270
 271        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string circuitName, st
 272        {
 0273            var message = _pipeline.CreateMessage();
 0274            var request = message.Request;
 0275            request.Method = RequestMethod.Get;
 0276            var uri = new RawRequestUriBuilder();
 0277            uri.Reset(endpoint);
 0278            uri.AppendRawNextLink(nextLink, false);
 0279            request.Uri = uri;
 0280            return message;
 281        }
 282
 283        /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu
 284        /// <param name="nextLink"> The URL to the next page of results. </param>
 285        /// <param name="resourceGroupName"> The name of the resource group. </param>
 286        /// <param name="circuitName"> The name of the circuit. </param>
 287        /// <param name="peeringName"> The name of the peering. </param>
 288        /// <param name="cancellationToken"> The cancellation token to use. </param>
 289        public async Task<Response<PeerExpressRouteCircuitConnectionListResult>> ListNextPageAsync(string nextLink, stri
 290        {
 0291            if (nextLink == null)
 292            {
 0293                throw new ArgumentNullException(nameof(nextLink));
 294            }
 0295            if (resourceGroupName == null)
 296            {
 0297                throw new ArgumentNullException(nameof(resourceGroupName));
 298            }
 0299            if (circuitName == null)
 300            {
 0301                throw new ArgumentNullException(nameof(circuitName));
 302            }
 0303            if (peeringName == null)
 304            {
 0305                throw new ArgumentNullException(nameof(peeringName));
 306            }
 307
 0308            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, circuitName, peeringName);
 0309            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0310            switch (message.Response.Status)
 311            {
 312                case 200:
 313                    {
 0314                        PeerExpressRouteCircuitConnectionListResult value = default;
 0315                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0316                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 317                        {
 0318                            value = null;
 319                        }
 320                        else
 321                        {
 0322                            value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec
 323                        }
 0324                        return Response.FromValue(value, message.Response);
 325                    }
 326                default:
 0327                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 328            }
 0329        }
 330
 331        /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu
 332        /// <param name="nextLink"> The URL to the next page of results. </param>
 333        /// <param name="resourceGroupName"> The name of the resource group. </param>
 334        /// <param name="circuitName"> The name of the circuit. </param>
 335        /// <param name="peeringName"> The name of the peering. </param>
 336        /// <param name="cancellationToken"> The cancellation token to use. </param>
 337        public Response<PeerExpressRouteCircuitConnectionListResult> ListNextPage(string nextLink, string resourceGroupN
 338        {
 0339            if (nextLink == null)
 340            {
 0341                throw new ArgumentNullException(nameof(nextLink));
 342            }
 0343            if (resourceGroupName == null)
 344            {
 0345                throw new ArgumentNullException(nameof(resourceGroupName));
 346            }
 0347            if (circuitName == null)
 348            {
 0349                throw new ArgumentNullException(nameof(circuitName));
 350            }
 0351            if (peeringName == null)
 352            {
 0353                throw new ArgumentNullException(nameof(peeringName));
 354            }
 355
 0356            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, circuitName, peeringName);
 0357            _pipeline.Send(message, cancellationToken);
 0358            switch (message.Response.Status)
 359            {
 360                case 200:
 361                    {
 0362                        PeerExpressRouteCircuitConnectionListResult value = default;
 0363                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0364                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 365                        {
 0366                            value = null;
 367                        }
 368                        else
 369                        {
 0370                            value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec
 371                        }
 0372                        return Response.FromValue(value, message.Response);
 373                    }
 374                default:
 0375                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 376            }
 0377        }
 378    }
 379}