< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\AvailableServiceAliasesRestOperations.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 AvailableServiceAliasesRestOperations
 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 AvailableServiceAliasesRestOperations. </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 AvailableServiceAliasesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string 
 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 location)
 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("/providers/Microsoft.Network/locations/", false);
 056            uri.AppendPath(location, true);
 057            uri.AppendPath("/availableServiceAliases", false);
 058            uri.AppendQuery("api-version", "2020-04-01", true);
 059            request.Uri = uri;
 060            return message;
 61        }
 62
 63        /// <summary> Gets all available service aliases for this subscription in this region. </summary>
 64        /// <param name="location"> The location. </param>
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public async Task<Response<AvailableServiceAliasesResult>> ListAsync(string location, CancellationToken cancella
 67        {
 068            if (location == null)
 69            {
 070                throw new ArgumentNullException(nameof(location));
 71            }
 72
 073            using var message = CreateListRequest(location);
 074            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 075            switch (message.Response.Status)
 76            {
 77                case 200:
 78                    {
 079                        AvailableServiceAliasesResult value = default;
 080                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 081                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 82                        {
 083                            value = null;
 84                        }
 85                        else
 86                        {
 087                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 88                        }
 089                        return Response.FromValue(value, message.Response);
 90                    }
 91                default:
 092                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 93            }
 094        }
 95
 96        /// <summary> Gets all available service aliases for this subscription in this region. </summary>
 97        /// <param name="location"> The location. </param>
 98        /// <param name="cancellationToken"> The cancellation token to use. </param>
 99        public Response<AvailableServiceAliasesResult> List(string location, CancellationToken cancellationToken = defau
 100        {
 0101            if (location == null)
 102            {
 0103                throw new ArgumentNullException(nameof(location));
 104            }
 105
 0106            using var message = CreateListRequest(location);
 0107            _pipeline.Send(message, cancellationToken);
 0108            switch (message.Response.Status)
 109            {
 110                case 200:
 111                    {
 0112                        AvailableServiceAliasesResult value = default;
 0113                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0114                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 115                        {
 0116                            value = null;
 117                        }
 118                        else
 119                        {
 0120                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 121                        }
 0122                        return Response.FromValue(value, message.Response);
 123                    }
 124                default:
 0125                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 126            }
 0127        }
 128
 129        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string location)
 130        {
 0131            var message = _pipeline.CreateMessage();
 0132            var request = message.Request;
 0133            request.Method = RequestMethod.Get;
 0134            var uri = new RawRequestUriBuilder();
 0135            uri.Reset(endpoint);
 0136            uri.AppendPath("/subscriptions/", false);
 0137            uri.AppendPath(subscriptionId, true);
 0138            uri.AppendPath("/resourceGroups/", false);
 0139            uri.AppendPath(resourceGroupName, true);
 0140            uri.AppendPath("/providers/Microsoft.Network/locations/", false);
 0141            uri.AppendPath(location, true);
 0142            uri.AppendPath("/availableServiceAliases", false);
 0143            uri.AppendQuery("api-version", "2020-04-01", true);
 0144            request.Uri = uri;
 0145            return message;
 146        }
 147
 148        /// <summary> Gets all available service aliases for this resource group in this region. </summary>
 149        /// <param name="resourceGroupName"> The name of the resource group. </param>
 150        /// <param name="location"> The location. </param>
 151        /// <param name="cancellationToken"> The cancellation token to use. </param>
 152        public async Task<Response<AvailableServiceAliasesResult>> ListByResourceGroupAsync(string resourceGroupName, st
 153        {
 0154            if (resourceGroupName == null)
 155            {
 0156                throw new ArgumentNullException(nameof(resourceGroupName));
 157            }
 0158            if (location == null)
 159            {
 0160                throw new ArgumentNullException(nameof(location));
 161            }
 162
 0163            using var message = CreateListByResourceGroupRequest(resourceGroupName, location);
 0164            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0165            switch (message.Response.Status)
 166            {
 167                case 200:
 168                    {
 0169                        AvailableServiceAliasesResult value = default;
 0170                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0171                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 172                        {
 0173                            value = null;
 174                        }
 175                        else
 176                        {
 0177                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 178                        }
 0179                        return Response.FromValue(value, message.Response);
 180                    }
 181                default:
 0182                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 183            }
 0184        }
 185
 186        /// <summary> Gets all available service aliases for this resource group in this region. </summary>
 187        /// <param name="resourceGroupName"> The name of the resource group. </param>
 188        /// <param name="location"> The location. </param>
 189        /// <param name="cancellationToken"> The cancellation token to use. </param>
 190        public Response<AvailableServiceAliasesResult> ListByResourceGroup(string resourceGroupName, string location, Ca
 191        {
 0192            if (resourceGroupName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(resourceGroupName));
 195            }
 0196            if (location == null)
 197            {
 0198                throw new ArgumentNullException(nameof(location));
 199            }
 200
 0201            using var message = CreateListByResourceGroupRequest(resourceGroupName, location);
 0202            _pipeline.Send(message, cancellationToken);
 0203            switch (message.Response.Status)
 204            {
 205                case 200:
 206                    {
 0207                        AvailableServiceAliasesResult value = default;
 0208                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0209                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 210                        {
 0211                            value = null;
 212                        }
 213                        else
 214                        {
 0215                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 216                        }
 0217                        return Response.FromValue(value, message.Response);
 218                    }
 219                default:
 0220                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 221            }
 0222        }
 223
 224        internal HttpMessage CreateListNextPageRequest(string nextLink, string location)
 225        {
 0226            var message = _pipeline.CreateMessage();
 0227            var request = message.Request;
 0228            request.Method = RequestMethod.Get;
 0229            var uri = new RawRequestUriBuilder();
 0230            uri.Reset(endpoint);
 0231            uri.AppendRawNextLink(nextLink, false);
 0232            request.Uri = uri;
 0233            return message;
 234        }
 235
 236        /// <summary> Gets all available service aliases for this subscription in this region. </summary>
 237        /// <param name="nextLink"> The URL to the next page of results. </param>
 238        /// <param name="location"> The location. </param>
 239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 240        public async Task<Response<AvailableServiceAliasesResult>> ListNextPageAsync(string nextLink, string location, C
 241        {
 0242            if (nextLink == null)
 243            {
 0244                throw new ArgumentNullException(nameof(nextLink));
 245            }
 0246            if (location == null)
 247            {
 0248                throw new ArgumentNullException(nameof(location));
 249            }
 250
 0251            using var message = CreateListNextPageRequest(nextLink, location);
 0252            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0253            switch (message.Response.Status)
 254            {
 255                case 200:
 256                    {
 0257                        AvailableServiceAliasesResult value = default;
 0258                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0259                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 260                        {
 0261                            value = null;
 262                        }
 263                        else
 264                        {
 0265                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 266                        }
 0267                        return Response.FromValue(value, message.Response);
 268                    }
 269                default:
 0270                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 271            }
 0272        }
 273
 274        /// <summary> Gets all available service aliases for this subscription in this region. </summary>
 275        /// <param name="nextLink"> The URL to the next page of results. </param>
 276        /// <param name="location"> The location. </param>
 277        /// <param name="cancellationToken"> The cancellation token to use. </param>
 278        public Response<AvailableServiceAliasesResult> ListNextPage(string nextLink, string location, CancellationToken 
 279        {
 0280            if (nextLink == null)
 281            {
 0282                throw new ArgumentNullException(nameof(nextLink));
 283            }
 0284            if (location == null)
 285            {
 0286                throw new ArgumentNullException(nameof(location));
 287            }
 288
 0289            using var message = CreateListNextPageRequest(nextLink, location);
 0290            _pipeline.Send(message, cancellationToken);
 0291            switch (message.Response.Status)
 292            {
 293                case 200:
 294                    {
 0295                        AvailableServiceAliasesResult value = default;
 0296                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0297                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 298                        {
 0299                            value = null;
 300                        }
 301                        else
 302                        {
 0303                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 304                        }
 0305                        return Response.FromValue(value, message.Response);
 306                    }
 307                default:
 0308                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 309            }
 0310        }
 311
 312        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string 
 313        {
 0314            var message = _pipeline.CreateMessage();
 0315            var request = message.Request;
 0316            request.Method = RequestMethod.Get;
 0317            var uri = new RawRequestUriBuilder();
 0318            uri.Reset(endpoint);
 0319            uri.AppendRawNextLink(nextLink, false);
 0320            request.Uri = uri;
 0321            return message;
 322        }
 323
 324        /// <summary> Gets all available service aliases for this resource group in this region. </summary>
 325        /// <param name="nextLink"> The URL to the next page of results. </param>
 326        /// <param name="resourceGroupName"> The name of the resource group. </param>
 327        /// <param name="location"> The location. </param>
 328        /// <param name="cancellationToken"> The cancellation token to use. </param>
 329        public async Task<Response<AvailableServiceAliasesResult>> ListByResourceGroupNextPageAsync(string nextLink, str
 330        {
 0331            if (nextLink == null)
 332            {
 0333                throw new ArgumentNullException(nameof(nextLink));
 334            }
 0335            if (resourceGroupName == null)
 336            {
 0337                throw new ArgumentNullException(nameof(resourceGroupName));
 338            }
 0339            if (location == null)
 340            {
 0341                throw new ArgumentNullException(nameof(location));
 342            }
 343
 0344            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, location);
 0345            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0346            switch (message.Response.Status)
 347            {
 348                case 200:
 349                    {
 0350                        AvailableServiceAliasesResult value = default;
 0351                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0352                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 353                        {
 0354                            value = null;
 355                        }
 356                        else
 357                        {
 0358                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 359                        }
 0360                        return Response.FromValue(value, message.Response);
 361                    }
 362                default:
 0363                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 364            }
 0365        }
 366
 367        /// <summary> Gets all available service aliases for this resource group in this region. </summary>
 368        /// <param name="nextLink"> The URL to the next page of results. </param>
 369        /// <param name="resourceGroupName"> The name of the resource group. </param>
 370        /// <param name="location"> The location. </param>
 371        /// <param name="cancellationToken"> The cancellation token to use. </param>
 372        public Response<AvailableServiceAliasesResult> ListByResourceGroupNextPage(string nextLink, string resourceGroup
 373        {
 0374            if (nextLink == null)
 375            {
 0376                throw new ArgumentNullException(nameof(nextLink));
 377            }
 0378            if (resourceGroupName == null)
 379            {
 0380                throw new ArgumentNullException(nameof(resourceGroupName));
 381            }
 0382            if (location == null)
 383            {
 0384                throw new ArgumentNullException(nameof(location));
 385            }
 386
 0387            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, location);
 0388            _pipeline.Send(message, cancellationToken);
 0389            switch (message.Response.Status)
 390            {
 391                case 200:
 392                    {
 0393                        AvailableServiceAliasesResult value = default;
 0394                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0395                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 396                        {
 0397                            value = null;
 398                        }
 399                        else
 400                        {
 0401                            value = AvailableServiceAliasesResult.DeserializeAvailableServiceAliasesResult(document.Root
 402                        }
 0403                        return Response.FromValue(value, message.Response);
 404                    }
 405                default:
 0406                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 407            }
 0408        }
 409    }
 410}