< Summary

Class:Azure.ResourceManager.Network.LoadBalancerOutboundRulesRestOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancerOutboundRulesRestOperations.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%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-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\LoadBalancerOutboundRulesRestOperations.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 LoadBalancerOutboundRulesRestOperations
 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 LoadBalancerOutboundRulesRestOperations. </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 LoadBalancerOutboundRulesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, strin
 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 CreateListRequest(string resourceGroupName, string loadBalancerName)
 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/loadBalancers/", false);
 058            uri.AppendPath(loadBalancerName, true);
 059            uri.AppendPath("/outboundRules", false);
 060            uri.AppendQuery("api-version", "2020-04-01", true);
 061            request.Uri = uri;
 062            return message;
 63        }
 64
 65        /// <summary> Gets all the outbound rules in a load balancer. </summary>
 66        /// <param name="resourceGroupName"> The name of the resource group. </param>
 67        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 68        /// <param name="cancellationToken"> The cancellation token to use. </param>
 69        public async Task<Response<LoadBalancerOutboundRuleListResult>> ListAsync(string resourceGroupName, string loadB
 70        {
 071            if (resourceGroupName == null)
 72            {
 073                throw new ArgumentNullException(nameof(resourceGroupName));
 74            }
 075            if (loadBalancerName == null)
 76            {
 077                throw new ArgumentNullException(nameof(loadBalancerName));
 78            }
 79
 080            using var message = CreateListRequest(resourceGroupName, loadBalancerName);
 081            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 082            switch (message.Response.Status)
 83            {
 84                case 200:
 85                    {
 086                        LoadBalancerOutboundRuleListResult value = default;
 087                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 088                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 89                        {
 090                            value = null;
 91                        }
 92                        else
 93                        {
 094                            value = LoadBalancerOutboundRuleListResult.DeserializeLoadBalancerOutboundRuleListResult(doc
 95                        }
 096                        return Response.FromValue(value, message.Response);
 97                    }
 98                default:
 099                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 100            }
 0101        }
 102
 103        /// <summary> Gets all the outbound rules in a load balancer. </summary>
 104        /// <param name="resourceGroupName"> The name of the resource group. </param>
 105        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 106        /// <param name="cancellationToken"> The cancellation token to use. </param>
 107        public Response<LoadBalancerOutboundRuleListResult> List(string resourceGroupName, string loadBalancerName, Canc
 108        {
 0109            if (resourceGroupName == null)
 110            {
 0111                throw new ArgumentNullException(nameof(resourceGroupName));
 112            }
 0113            if (loadBalancerName == null)
 114            {
 0115                throw new ArgumentNullException(nameof(loadBalancerName));
 116            }
 117
 0118            using var message = CreateListRequest(resourceGroupName, loadBalancerName);
 0119            _pipeline.Send(message, cancellationToken);
 0120            switch (message.Response.Status)
 121            {
 122                case 200:
 123                    {
 0124                        LoadBalancerOutboundRuleListResult value = default;
 0125                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0126                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 127                        {
 0128                            value = null;
 129                        }
 130                        else
 131                        {
 0132                            value = LoadBalancerOutboundRuleListResult.DeserializeLoadBalancerOutboundRuleListResult(doc
 133                        }
 0134                        return Response.FromValue(value, message.Response);
 135                    }
 136                default:
 0137                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 138            }
 0139        }
 140
 141        internal HttpMessage CreateGetRequest(string resourceGroupName, string loadBalancerName, string outboundRuleName
 142        {
 0143            var message = _pipeline.CreateMessage();
 0144            var request = message.Request;
 0145            request.Method = RequestMethod.Get;
 0146            var uri = new RawRequestUriBuilder();
 0147            uri.Reset(endpoint);
 0148            uri.AppendPath("/subscriptions/", false);
 0149            uri.AppendPath(subscriptionId, true);
 0150            uri.AppendPath("/resourceGroups/", false);
 0151            uri.AppendPath(resourceGroupName, true);
 0152            uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false);
 0153            uri.AppendPath(loadBalancerName, true);
 0154            uri.AppendPath("/outboundRules/", false);
 0155            uri.AppendPath(outboundRuleName, true);
 0156            uri.AppendQuery("api-version", "2020-04-01", true);
 0157            request.Uri = uri;
 0158            return message;
 159        }
 160
 161        /// <summary> Gets the specified load balancer outbound rule. </summary>
 162        /// <param name="resourceGroupName"> The name of the resource group. </param>
 163        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 164        /// <param name="outboundRuleName"> The name of the outbound rule. </param>
 165        /// <param name="cancellationToken"> The cancellation token to use. </param>
 166        public async Task<Response<OutboundRule>> GetAsync(string resourceGroupName, string loadBalancerName, string out
 167        {
 0168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 0172            if (loadBalancerName == null)
 173            {
 0174                throw new ArgumentNullException(nameof(loadBalancerName));
 175            }
 0176            if (outboundRuleName == null)
 177            {
 0178                throw new ArgumentNullException(nameof(outboundRuleName));
 179            }
 180
 0181            using var message = CreateGetRequest(resourceGroupName, loadBalancerName, outboundRuleName);
 0182            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0183            switch (message.Response.Status)
 184            {
 185                case 200:
 186                    {
 0187                        OutboundRule value = default;
 0188                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0189                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 190                        {
 0191                            value = null;
 192                        }
 193                        else
 194                        {
 0195                            value = OutboundRule.DeserializeOutboundRule(document.RootElement);
 196                        }
 0197                        return Response.FromValue(value, message.Response);
 198                    }
 199                default:
 0200                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 201            }
 0202        }
 203
 204        /// <summary> Gets the specified load balancer outbound rule. </summary>
 205        /// <param name="resourceGroupName"> The name of the resource group. </param>
 206        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 207        /// <param name="outboundRuleName"> The name of the outbound rule. </param>
 208        /// <param name="cancellationToken"> The cancellation token to use. </param>
 209        public Response<OutboundRule> Get(string resourceGroupName, string loadBalancerName, string outboundRuleName, Ca
 210        {
 0211            if (resourceGroupName == null)
 212            {
 0213                throw new ArgumentNullException(nameof(resourceGroupName));
 214            }
 0215            if (loadBalancerName == null)
 216            {
 0217                throw new ArgumentNullException(nameof(loadBalancerName));
 218            }
 0219            if (outboundRuleName == null)
 220            {
 0221                throw new ArgumentNullException(nameof(outboundRuleName));
 222            }
 223
 0224            using var message = CreateGetRequest(resourceGroupName, loadBalancerName, outboundRuleName);
 0225            _pipeline.Send(message, cancellationToken);
 0226            switch (message.Response.Status)
 227            {
 228                case 200:
 229                    {
 0230                        OutboundRule 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 = OutboundRule.DeserializeOutboundRule(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 CreateListNextPageRequest(string nextLink, string resourceGroupName, string loadBalancerNam
 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> Gets all the outbound rules in a load balancer. </summary>
 260        /// <param name="nextLink"> The URL to the next page of results. </param>
 261        /// <param name="resourceGroupName"> The name of the resource group. </param>
 262        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 263        /// <param name="cancellationToken"> The cancellation token to use. </param>
 264        public async Task<Response<LoadBalancerOutboundRuleListResult>> ListNextPageAsync(string nextLink, string resour
 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 (loadBalancerName == null)
 275            {
 0276                throw new ArgumentNullException(nameof(loadBalancerName));
 277            }
 278
 0279            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName);
 0280            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0281            switch (message.Response.Status)
 282            {
 283                case 200:
 284                    {
 0285                        LoadBalancerOutboundRuleListResult 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 = LoadBalancerOutboundRuleListResult.DeserializeLoadBalancerOutboundRuleListResult(doc
 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> Gets all the outbound rules in a load balancer. </summary>
 303        /// <param name="nextLink"> The URL to the next page of results. </param>
 304        /// <param name="resourceGroupName"> The name of the resource group. </param>
 305        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 306        /// <param name="cancellationToken"> The cancellation token to use. </param>
 307        public Response<LoadBalancerOutboundRuleListResult> ListNextPage(string nextLink, string resourceGroupName, stri
 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 (loadBalancerName == null)
 318            {
 0319                throw new ArgumentNullException(nameof(loadBalancerName));
 320            }
 321
 0322            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName);
 0323            _pipeline.Send(message, cancellationToken);
 0324            switch (message.Response.Status)
 325            {
 326                case 200:
 327                    {
 0328                        LoadBalancerOutboundRuleListResult 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 = LoadBalancerOutboundRuleListResult.DeserializeLoadBalancerOutboundRuleListResult(doc
 337                        }
 0338                        return Response.FromValue(value, message.Response);
 339                    }
 340                default:
 0341                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 342            }
 0343        }
 344    }
 345}