< Summary

Class:Azure.ResourceManager.AppConfiguration.PrivateLinkResourcesRestOperations
Assembly:Azure.ResourceManager.AppConfiguration
File(s):C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\PrivateLinkResourcesRestOperations.cs
Covered lines:87
Uncovered lines:62
Coverable lines:149
Total lines:352
Line coverage:58.3% (87 of 149)
Covered branches:21
Total branches:62
Branch coverage:33.8% (21 of 62)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-83.33%50%
CreateListByConfigurationStoreRequest(...)-100%100%
ListByConfigurationStoreAsync()-73.33%50%
ListByConfigurationStore(...)-73.33%50%
CreateGetRequest(...)-100%100%
GetAsync()-70.59%50%
Get(...)-70.59%50%
CreateListByConfigurationStoreNextPageRequest(...)-0%100%
ListByConfigurationStoreNextPageAsync()-0%0%
ListByConfigurationStoreNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\PrivateLinkResourcesRestOperations.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.AppConfiguration.Models;
 16
 17namespace Azure.ResourceManager.AppConfiguration
 18{
 19    internal partial class PrivateLinkResourcesRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private string apiVersion;
 24        private ClientDiagnostics _clientDiagnostics;
 25        private HttpPipeline _pipeline;
 26
 27        /// <summary> Initializes a new instance of PrivateLinkResourcesRestOperations. </summary>
 28        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 29        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 30        /// <param name="subscriptionId"> The Microsoft Azure subscription ID. </param>
 31        /// <param name="endpoint"> server parameter. </param>
 32        /// <param name="apiVersion"> Api Version. </param>
 33        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 834        public PrivateLinkResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string sub
 35        {
 836            if (subscriptionId == null)
 37            {
 038                throw new ArgumentNullException(nameof(subscriptionId));
 39            }
 840            endpoint ??= new Uri("https://management.azure.com");
 841            if (apiVersion == null)
 42            {
 043                throw new ArgumentNullException(nameof(apiVersion));
 44            }
 45
 846            this.subscriptionId = subscriptionId;
 847            this.endpoint = endpoint;
 848            this.apiVersion = apiVersion;
 849            _clientDiagnostics = clientDiagnostics;
 850            _pipeline = pipeline;
 851        }
 52
 53        internal HttpMessage CreateListByConfigurationStoreRequest(string resourceGroupName, string configStoreName)
 54        {
 1255            var message = _pipeline.CreateMessage();
 1256            var request = message.Request;
 1257            request.Method = RequestMethod.Get;
 1258            var uri = new RawRequestUriBuilder();
 1259            uri.Reset(endpoint);
 1260            uri.AppendPath("/subscriptions/", false);
 1261            uri.AppendPath(subscriptionId, true);
 1262            uri.AppendPath("/resourceGroups/", false);
 1263            uri.AppendPath(resourceGroupName, true);
 1264            uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false);
 1265            uri.AppendPath(configStoreName, true);
 1266            uri.AppendPath("/privateLinkResources", false);
 1267            uri.AppendQuery("api-version", apiVersion, true);
 1268            request.Uri = uri;
 1269            return message;
 70        }
 71
 72        /// <summary> Gets the private link resources that need to be created for a configuration store. </summary>
 73        /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p
 74        /// <param name="configStoreName"> The name of the configuration store. </param>
 75        /// <param name="cancellationToken"> The cancellation token to use. </param>
 76        public async Task<Response<PrivateLinkResourceListResult>> ListByConfigurationStoreAsync(string resourceGroupNam
 77        {
 678            if (resourceGroupName == null)
 79            {
 080                throw new ArgumentNullException(nameof(resourceGroupName));
 81            }
 682            if (configStoreName == null)
 83            {
 084                throw new ArgumentNullException(nameof(configStoreName));
 85            }
 86
 687            using var message = CreateListByConfigurationStoreRequest(resourceGroupName, configStoreName);
 688            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 689            switch (message.Response.Status)
 90            {
 91                case 200:
 92                    {
 693                        PrivateLinkResourceListResult value = default;
 694                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 695                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 96                        {
 097                            value = null;
 98                        }
 99                        else
 100                        {
 6101                            value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root
 102                        }
 6103                        return Response.FromValue(value, message.Response);
 104                    }
 105                default:
 0106                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 107            }
 6108        }
 109
 110        /// <summary> Gets the private link resources that need to be created for a configuration store. </summary>
 111        /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p
 112        /// <param name="configStoreName"> The name of the configuration store. </param>
 113        /// <param name="cancellationToken"> The cancellation token to use. </param>
 114        public Response<PrivateLinkResourceListResult> ListByConfigurationStore(string resourceGroupName, string configS
 115        {
 6116            if (resourceGroupName == null)
 117            {
 0118                throw new ArgumentNullException(nameof(resourceGroupName));
 119            }
 6120            if (configStoreName == null)
 121            {
 0122                throw new ArgumentNullException(nameof(configStoreName));
 123            }
 124
 6125            using var message = CreateListByConfigurationStoreRequest(resourceGroupName, configStoreName);
 6126            _pipeline.Send(message, cancellationToken);
 6127            switch (message.Response.Status)
 128            {
 129                case 200:
 130                    {
 6131                        PrivateLinkResourceListResult value = default;
 6132                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6133                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 134                        {
 0135                            value = null;
 136                        }
 137                        else
 138                        {
 6139                            value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root
 140                        }
 6141                        return Response.FromValue(value, message.Response);
 142                    }
 143                default:
 0144                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 145            }
 6146        }
 147
 148        internal HttpMessage CreateGetRequest(string resourceGroupName, string configStoreName, string groupName)
 149        {
 8150            var message = _pipeline.CreateMessage();
 8151            var request = message.Request;
 8152            request.Method = RequestMethod.Get;
 8153            var uri = new RawRequestUriBuilder();
 8154            uri.Reset(endpoint);
 8155            uri.AppendPath("/subscriptions/", false);
 8156            uri.AppendPath(subscriptionId, true);
 8157            uri.AppendPath("/resourceGroups/", false);
 8158            uri.AppendPath(resourceGroupName, true);
 8159            uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false);
 8160            uri.AppendPath(configStoreName, true);
 8161            uri.AppendPath("/privateLinkResources/", false);
 8162            uri.AppendPath(groupName, true);
 8163            uri.AppendQuery("api-version", apiVersion, true);
 8164            request.Uri = uri;
 8165            return message;
 166        }
 167
 168        /// <summary> Gets a private link resource that need to be created for a configuration store. </summary>
 169        /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p
 170        /// <param name="configStoreName"> The name of the configuration store. </param>
 171        /// <param name="groupName"> The name of the private link resource group. </param>
 172        /// <param name="cancellationToken"> The cancellation token to use. </param>
 173        public async Task<Response<PrivateLinkResource>> GetAsync(string resourceGroupName, string configStoreName, stri
 174        {
 4175            if (resourceGroupName == null)
 176            {
 0177                throw new ArgumentNullException(nameof(resourceGroupName));
 178            }
 4179            if (configStoreName == null)
 180            {
 0181                throw new ArgumentNullException(nameof(configStoreName));
 182            }
 4183            if (groupName == null)
 184            {
 0185                throw new ArgumentNullException(nameof(groupName));
 186            }
 187
 4188            using var message = CreateGetRequest(resourceGroupName, configStoreName, groupName);
 4189            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4190            switch (message.Response.Status)
 191            {
 192                case 200:
 193                    {
 4194                        PrivateLinkResource value = default;
 4195                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4196                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 197                        {
 0198                            value = null;
 199                        }
 200                        else
 201                        {
 4202                            value = PrivateLinkResource.DeserializePrivateLinkResource(document.RootElement);
 203                        }
 4204                        return Response.FromValue(value, message.Response);
 205                    }
 206                default:
 0207                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 208            }
 4209        }
 210
 211        /// <summary> Gets a private link resource that need to be created for a configuration store. </summary>
 212        /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p
 213        /// <param name="configStoreName"> The name of the configuration store. </param>
 214        /// <param name="groupName"> The name of the private link resource group. </param>
 215        /// <param name="cancellationToken"> The cancellation token to use. </param>
 216        public Response<PrivateLinkResource> Get(string resourceGroupName, string configStoreName, string groupName, Can
 217        {
 4218            if (resourceGroupName == null)
 219            {
 0220                throw new ArgumentNullException(nameof(resourceGroupName));
 221            }
 4222            if (configStoreName == null)
 223            {
 0224                throw new ArgumentNullException(nameof(configStoreName));
 225            }
 4226            if (groupName == null)
 227            {
 0228                throw new ArgumentNullException(nameof(groupName));
 229            }
 230
 4231            using var message = CreateGetRequest(resourceGroupName, configStoreName, groupName);
 4232            _pipeline.Send(message, cancellationToken);
 4233            switch (message.Response.Status)
 234            {
 235                case 200:
 236                    {
 4237                        PrivateLinkResource value = default;
 4238                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4239                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 240                        {
 0241                            value = null;
 242                        }
 243                        else
 244                        {
 4245                            value = PrivateLinkResource.DeserializePrivateLinkResource(document.RootElement);
 246                        }
 4247                        return Response.FromValue(value, message.Response);
 248                    }
 249                default:
 0250                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 251            }
 4252        }
 253
 254        internal HttpMessage CreateListByConfigurationStoreNextPageRequest(string nextLink, string resourceGroupName, st
 255        {
 0256            var message = _pipeline.CreateMessage();
 0257            var request = message.Request;
 0258            request.Method = RequestMethod.Get;
 0259            var uri = new RawRequestUriBuilder();
 0260            uri.Reset(endpoint);
 0261            uri.AppendRawNextLink(nextLink, false);
 0262            request.Uri = uri;
 0263            return message;
 264        }
 265
 266        /// <summary> Gets the private link resources that need to be created for a configuration store. </summary>
 267        /// <param name="nextLink"> The URL to the next page of results. </param>
 268        /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p
 269        /// <param name="configStoreName"> The name of the configuration store. </param>
 270        /// <param name="cancellationToken"> The cancellation token to use. </param>
 271        public async Task<Response<PrivateLinkResourceListResult>> ListByConfigurationStoreNextPageAsync(string nextLink
 272        {
 0273            if (nextLink == null)
 274            {
 0275                throw new ArgumentNullException(nameof(nextLink));
 276            }
 0277            if (resourceGroupName == null)
 278            {
 0279                throw new ArgumentNullException(nameof(resourceGroupName));
 280            }
 0281            if (configStoreName == null)
 282            {
 0283                throw new ArgumentNullException(nameof(configStoreName));
 284            }
 285
 0286            using var message = CreateListByConfigurationStoreNextPageRequest(nextLink, resourceGroupName, configStoreNa
 0287            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0288            switch (message.Response.Status)
 289            {
 290                case 200:
 291                    {
 0292                        PrivateLinkResourceListResult value = default;
 0293                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0294                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 295                        {
 0296                            value = null;
 297                        }
 298                        else
 299                        {
 0300                            value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root
 301                        }
 0302                        return Response.FromValue(value, message.Response);
 303                    }
 304                default:
 0305                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 306            }
 0307        }
 308
 309        /// <summary> Gets the private link resources that need to be created for a configuration store. </summary>
 310        /// <param name="nextLink"> The URL to the next page of results. </param>
 311        /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p
 312        /// <param name="configStoreName"> The name of the configuration store. </param>
 313        /// <param name="cancellationToken"> The cancellation token to use. </param>
 314        public Response<PrivateLinkResourceListResult> ListByConfigurationStoreNextPage(string nextLink, string resource
 315        {
 0316            if (nextLink == null)
 317            {
 0318                throw new ArgumentNullException(nameof(nextLink));
 319            }
 0320            if (resourceGroupName == null)
 321            {
 0322                throw new ArgumentNullException(nameof(resourceGroupName));
 323            }
 0324            if (configStoreName == null)
 325            {
 0326                throw new ArgumentNullException(nameof(configStoreName));
 327            }
 328
 0329            using var message = CreateListByConfigurationStoreNextPageRequest(nextLink, resourceGroupName, configStoreNa
 0330            _pipeline.Send(message, cancellationToken);
 0331            switch (message.Response.Status)
 332            {
 333                case 200:
 334                    {
 0335                        PrivateLinkResourceListResult value = default;
 0336                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0337                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 338                        {
 0339                            value = null;
 340                        }
 341                        else
 342                        {
 0343                            value = PrivateLinkResourceListResult.DeserializePrivateLinkResourceListResult(document.Root
 344                        }
 0345                        return Response.FromValue(value, message.Response);
 346                    }
 347                default:
 0348                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 349            }
 0350        }
 351    }
 352}