< Summary

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

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\NetworkInterfaceIPConfigurationsRestOperations.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 NetworkInterfaceIPConfigurationsRestOperations
 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 NetworkInterfaceIPConfigurationsRestOperations. </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
 832        public NetworkInterfaceIPConfigurationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline
 33        {
 834            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 838            endpoint ??= new Uri("https://management.azure.com");
 39
 840            this.subscriptionId = subscriptionId;
 841            this.endpoint = endpoint;
 842            _clientDiagnostics = clientDiagnostics;
 843            _pipeline = pipeline;
 844        }
 45
 46        internal HttpMessage CreateListRequest(string resourceGroupName, string networkInterfaceName)
 47        {
 448            var message = _pipeline.CreateMessage();
 449            var request = message.Request;
 450            request.Method = RequestMethod.Get;
 451            var uri = new RawRequestUriBuilder();
 452            uri.Reset(endpoint);
 453            uri.AppendPath("/subscriptions/", false);
 454            uri.AppendPath(subscriptionId, true);
 455            uri.AppendPath("/resourceGroups/", false);
 456            uri.AppendPath(resourceGroupName, true);
 457            uri.AppendPath("/providers/Microsoft.Network/networkInterfaces/", false);
 458            uri.AppendPath(networkInterfaceName, true);
 459            uri.AppendPath("/ipConfigurations", false);
 460            uri.AppendQuery("api-version", "2020-04-01", true);
 461            request.Uri = uri;
 462            return message;
 63        }
 64
 65        /// <summary> Get all ip configurations in a network interface. </summary>
 66        /// <param name="resourceGroupName"> The name of the resource group. </param>
 67        /// <param name="networkInterfaceName"> The name of the network interface. </param>
 68        /// <param name="cancellationToken"> The cancellation token to use. </param>
 69        public async Task<Response<NetworkInterfaceIPConfigurationListResult>> ListAsync(string resourceGroupName, strin
 70        {
 271            if (resourceGroupName == null)
 72            {
 073                throw new ArgumentNullException(nameof(resourceGroupName));
 74            }
 275            if (networkInterfaceName == null)
 76            {
 077                throw new ArgumentNullException(nameof(networkInterfaceName));
 78            }
 79
 280            using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
 281            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 282            switch (message.Response.Status)
 83            {
 84                case 200:
 85                    {
 286                        NetworkInterfaceIPConfigurationListResult value = default;
 287                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 288                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 89                        {
 090                            value = null;
 91                        }
 92                        else
 93                        {
 294                            value = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfiguration
 95                        }
 296                        return Response.FromValue(value, message.Response);
 97                    }
 98                default:
 099                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 100            }
 2101        }
 102
 103        /// <summary> Get all ip configurations in a network interface. </summary>
 104        /// <param name="resourceGroupName"> The name of the resource group. </param>
 105        /// <param name="networkInterfaceName"> The name of the network interface. </param>
 106        /// <param name="cancellationToken"> The cancellation token to use. </param>
 107        public Response<NetworkInterfaceIPConfigurationListResult> List(string resourceGroupName, string networkInterfac
 108        {
 2109            if (resourceGroupName == null)
 110            {
 0111                throw new ArgumentNullException(nameof(resourceGroupName));
 112            }
 2113            if (networkInterfaceName == null)
 114            {
 0115                throw new ArgumentNullException(nameof(networkInterfaceName));
 116            }
 117
 2118            using var message = CreateListRequest(resourceGroupName, networkInterfaceName);
 2119            _pipeline.Send(message, cancellationToken);
 2120            switch (message.Response.Status)
 121            {
 122                case 200:
 123                    {
 2124                        NetworkInterfaceIPConfigurationListResult value = default;
 2125                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2126                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 127                        {
 0128                            value = null;
 129                        }
 130                        else
 131                        {
 2132                            value = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfiguration
 133                        }
 2134                        return Response.FromValue(value, message.Response);
 135                    }
 136                default:
 0137                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 138            }
 2139        }
 140
 141        internal HttpMessage CreateGetRequest(string resourceGroupName, string networkInterfaceName, string ipConfigurat
 142        {
 4143            var message = _pipeline.CreateMessage();
 4144            var request = message.Request;
 4145            request.Method = RequestMethod.Get;
 4146            var uri = new RawRequestUriBuilder();
 4147            uri.Reset(endpoint);
 4148            uri.AppendPath("/subscriptions/", false);
 4149            uri.AppendPath(subscriptionId, true);
 4150            uri.AppendPath("/resourceGroups/", false);
 4151            uri.AppendPath(resourceGroupName, true);
 4152            uri.AppendPath("/providers/Microsoft.Network/networkInterfaces/", false);
 4153            uri.AppendPath(networkInterfaceName, true);
 4154            uri.AppendPath("/ipConfigurations/", false);
 4155            uri.AppendPath(ipConfigurationName, true);
 4156            uri.AppendQuery("api-version", "2020-04-01", true);
 4157            request.Uri = uri;
 4158            return message;
 159        }
 160
 161        /// <summary> Gets the specified network interface ip configuration. </summary>
 162        /// <param name="resourceGroupName"> The name of the resource group. </param>
 163        /// <param name="networkInterfaceName"> The name of the network interface. </param>
 164        /// <param name="ipConfigurationName"> The name of the ip configuration name. </param>
 165        /// <param name="cancellationToken"> The cancellation token to use. </param>
 166        public async Task<Response<NetworkInterfaceIPConfiguration>> GetAsync(string resourceGroupName, string networkIn
 167        {
 2168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 2172            if (networkInterfaceName == null)
 173            {
 0174                throw new ArgumentNullException(nameof(networkInterfaceName));
 175            }
 2176            if (ipConfigurationName == null)
 177            {
 0178                throw new ArgumentNullException(nameof(ipConfigurationName));
 179            }
 180
 2181            using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, ipConfigurationName);
 2182            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2183            switch (message.Response.Status)
 184            {
 185                case 200:
 186                    {
 2187                        NetworkInterfaceIPConfiguration value = default;
 2188                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2189                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 190                        {
 0191                            value = null;
 192                        }
 193                        else
 194                        {
 2195                            value = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(document.
 196                        }
 2197                        return Response.FromValue(value, message.Response);
 198                    }
 199                default:
 0200                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 201            }
 2202        }
 203
 204        /// <summary> Gets the specified network interface ip configuration. </summary>
 205        /// <param name="resourceGroupName"> The name of the resource group. </param>
 206        /// <param name="networkInterfaceName"> The name of the network interface. </param>
 207        /// <param name="ipConfigurationName"> The name of the ip configuration name. </param>
 208        /// <param name="cancellationToken"> The cancellation token to use. </param>
 209        public Response<NetworkInterfaceIPConfiguration> Get(string resourceGroupName, string networkInterfaceName, stri
 210        {
 2211            if (resourceGroupName == null)
 212            {
 0213                throw new ArgumentNullException(nameof(resourceGroupName));
 214            }
 2215            if (networkInterfaceName == null)
 216            {
 0217                throw new ArgumentNullException(nameof(networkInterfaceName));
 218            }
 2219            if (ipConfigurationName == null)
 220            {
 0221                throw new ArgumentNullException(nameof(ipConfigurationName));
 222            }
 223
 2224            using var message = CreateGetRequest(resourceGroupName, networkInterfaceName, ipConfigurationName);
 2225            _pipeline.Send(message, cancellationToken);
 2226            switch (message.Response.Status)
 227            {
 228                case 200:
 229                    {
 2230                        NetworkInterfaceIPConfiguration value = default;
 2231                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2232                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 233                        {
 0234                            value = null;
 235                        }
 236                        else
 237                        {
 2238                            value = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(document.
 239                        }
 2240                        return Response.FromValue(value, message.Response);
 241                    }
 242                default:
 0243                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 244            }
 2245        }
 246
 247        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string networkInterfac
 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> Get all ip configurations in a network interface. </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="networkInterfaceName"> The name of the network interface. </param>
 263        /// <param name="cancellationToken"> The cancellation token to use. </param>
 264        public async Task<Response<NetworkInterfaceIPConfigurationListResult>> ListNextPageAsync(string nextLink, string
 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 (networkInterfaceName == null)
 275            {
 0276                throw new ArgumentNullException(nameof(networkInterfaceName));
 277            }
 278
 0279            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
 0280            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0281            switch (message.Response.Status)
 282            {
 283                case 200:
 284                    {
 0285                        NetworkInterfaceIPConfigurationListResult 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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfiguration
 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> Get all ip configurations in a network interface. </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="networkInterfaceName"> The name of the network interface. </param>
 306        /// <param name="cancellationToken"> The cancellation token to use. </param>
 307        public Response<NetworkInterfaceIPConfigurationListResult> ListNextPage(string nextLink, string resourceGroupNam
 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 (networkInterfaceName == null)
 318            {
 0319                throw new ArgumentNullException(nameof(networkInterfaceName));
 320            }
 321
 0322            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, networkInterfaceName);
 0323            _pipeline.Send(message, cancellationToken);
 0324            switch (message.Response.Status)
 325            {
 326                case 200:
 327                    {
 0328                        NetworkInterfaceIPConfigurationListResult 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 = NetworkInterfaceIPConfigurationListResult.DeserializeNetworkInterfaceIPConfiguration
 337                        }
 0338                        return Response.FromValue(value, message.Response);
 339                    }
 340                default:
 0341                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 342            }
 0343        }
 344    }
 345}