< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-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\AvailableResourceGroupDelegationsRestOperations.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 AvailableResourceGroupDelegationsRestOperations
 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 AvailableResourceGroupDelegationsRestOperations. </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 AvailableResourceGroupDelegationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin
 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, string resourceGroupName)
 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/locations/", false);
 058            uri.AppendPath(location, true);
 059            uri.AppendPath("/availableDelegations", false);
 060            uri.AppendQuery("api-version", "2020-04-01", true);
 061            request.Uri = uri;
 062            return message;
 63        }
 64
 65        /// <summary> Gets all of the available subnet delegations for this resource group in this region. </summary>
 66        /// <param name="location"> The location of the domain name. </param>
 67        /// <param name="resourceGroupName"> The name of the resource group. </param>
 68        /// <param name="cancellationToken"> The cancellation token to use. </param>
 69        public async Task<Response<AvailableDelegationsResult>> ListAsync(string location, string resourceGroupName, Can
 70        {
 071            if (location == null)
 72            {
 073                throw new ArgumentNullException(nameof(location));
 74            }
 075            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 79
 080            using var message = CreateListRequest(location, resourceGroupName);
 081            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 082            switch (message.Response.Status)
 83            {
 84                case 200:
 85                    {
 086                        AvailableDelegationsResult 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 = AvailableDelegationsResult.DeserializeAvailableDelegationsResult(document.RootElemen
 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 of the available subnet delegations for this resource group in this region. </summary>
 104        /// <param name="location"> The location of the domain name. </param>
 105        /// <param name="resourceGroupName"> The name of the resource group. </param>
 106        /// <param name="cancellationToken"> The cancellation token to use. </param>
 107        public Response<AvailableDelegationsResult> List(string location, string resourceGroupName, CancellationToken ca
 108        {
 0109            if (location == null)
 110            {
 0111                throw new ArgumentNullException(nameof(location));
 112            }
 0113            if (resourceGroupName == null)
 114            {
 0115                throw new ArgumentNullException(nameof(resourceGroupName));
 116            }
 117
 0118            using var message = CreateListRequest(location, resourceGroupName);
 0119            _pipeline.Send(message, cancellationToken);
 0120            switch (message.Response.Status)
 121            {
 122                case 200:
 123                    {
 0124                        AvailableDelegationsResult 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 = AvailableDelegationsResult.DeserializeAvailableDelegationsResult(document.RootElemen
 133                        }
 0134                        return Response.FromValue(value, message.Response);
 135                    }
 136                default:
 0137                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 138            }
 0139        }
 140
 141        internal HttpMessage CreateListNextPageRequest(string nextLink, string location, string resourceGroupName)
 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.AppendRawNextLink(nextLink, false);
 0149            request.Uri = uri;
 0150            return message;
 151        }
 152
 153        /// <summary> Gets all of the available subnet delegations for this resource group in this region. </summary>
 154        /// <param name="nextLink"> The URL to the next page of results. </param>
 155        /// <param name="location"> The location of the domain name. </param>
 156        /// <param name="resourceGroupName"> The name of the resource group. </param>
 157        /// <param name="cancellationToken"> The cancellation token to use. </param>
 158        public async Task<Response<AvailableDelegationsResult>> ListNextPageAsync(string nextLink, string location, stri
 159        {
 0160            if (nextLink == null)
 161            {
 0162                throw new ArgumentNullException(nameof(nextLink));
 163            }
 0164            if (location == null)
 165            {
 0166                throw new ArgumentNullException(nameof(location));
 167            }
 0168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 172
 0173            using var message = CreateListNextPageRequest(nextLink, location, resourceGroupName);
 0174            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0175            switch (message.Response.Status)
 176            {
 177                case 200:
 178                    {
 0179                        AvailableDelegationsResult value = default;
 0180                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0181                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 182                        {
 0183                            value = null;
 184                        }
 185                        else
 186                        {
 0187                            value = AvailableDelegationsResult.DeserializeAvailableDelegationsResult(document.RootElemen
 188                        }
 0189                        return Response.FromValue(value, message.Response);
 190                    }
 191                default:
 0192                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 193            }
 0194        }
 195
 196        /// <summary> Gets all of the available subnet delegations for this resource group in this region. </summary>
 197        /// <param name="nextLink"> The URL to the next page of results. </param>
 198        /// <param name="location"> The location of the domain name. </param>
 199        /// <param name="resourceGroupName"> The name of the resource group. </param>
 200        /// <param name="cancellationToken"> The cancellation token to use. </param>
 201        public Response<AvailableDelegationsResult> ListNextPage(string nextLink, string location, string resourceGroupN
 202        {
 0203            if (nextLink == null)
 204            {
 0205                throw new ArgumentNullException(nameof(nextLink));
 206            }
 0207            if (location == null)
 208            {
 0209                throw new ArgumentNullException(nameof(location));
 210            }
 0211            if (resourceGroupName == null)
 212            {
 0213                throw new ArgumentNullException(nameof(resourceGroupName));
 214            }
 215
 0216            using var message = CreateListNextPageRequest(nextLink, location, resourceGroupName);
 0217            _pipeline.Send(message, cancellationToken);
 0218            switch (message.Response.Status)
 219            {
 220                case 200:
 221                    {
 0222                        AvailableDelegationsResult value = default;
 0223                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0224                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 225                        {
 0226                            value = null;
 227                        }
 228                        else
 229                        {
 0230                            value = AvailableDelegationsResult.DeserializeAvailableDelegationsResult(document.RootElemen
 231                        }
 0232                        return Response.FromValue(value, message.Response);
 233                    }
 234                default:
 0235                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 236            }
 0237        }
 238    }
 239}