< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
GetAsync()-0%100%
Get(...)-0%100%
ListAsync(...)-0%0%
<ListAsync()-0%100%
<ListAsync()-0%100%
List(...)-0%0%
<ListBySubscriptionAsync()-0%100%
<ListBySubscriptionAsync()-0%100%
ListBySubscriptionAsync(...)-0%100%
ListBySubscription(...)-0%100%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%
StartCreateOrUpdateAsync()-0%0%
StartCreateOrUpdate(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\PrivateEndpointsOperations.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.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.Network.Models;
 15
 16namespace Azure.ResourceManager.Network
 17{
 18    /// <summary> The PrivateEndpoints service client. </summary>
 19    public partial class PrivateEndpointsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal PrivateEndpointsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of PrivateEndpointsOperations for mocking. </summary>
 025        protected PrivateEndpointsOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of PrivateEndpointsOperations. </summary>
 29        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc
 32        /// <param name="endpoint"> server parameter. </param>
 033        internal PrivateEndpointsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript
 34        {
 035            RestClient = new PrivateEndpointsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the specified private endpoint by resource group. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="privateEndpointName"> The name of the private endpoint. </param>
 43        /// <param name="expand"> Expands referenced resources. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<PrivateEndpoint>> GetAsync(string resourceGroupName, string privateEndpointNa
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.Get");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.GetAsync(resourceGroupName, privateEndpointName, expand, cancellationToken).Conf
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Gets the specified private endpoint by resource group. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="privateEndpointName"> The name of the private endpoint. </param>
 63        /// <param name="expand"> Expands referenced resources. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<PrivateEndpoint> Get(string resourceGroupName, string privateEndpointName, string expand
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.Get");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Get(resourceGroupName, privateEndpointName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Gets all private endpoints in a resource group. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="cancellationToken"> The cancellation token to use. </param>
 83        public virtual AsyncPageable<PrivateEndpoint> ListAsync(string resourceGroupName, CancellationToken cancellation
 84        {
 085            if (resourceGroupName == null)
 86            {
 087                throw new ArgumentNullException(nameof(resourceGroupName));
 88            }
 89
 90            async Task<Page<PrivateEndpoint>> FirstPageFunc(int? pageSizeHint)
 91            {
 092                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.List");
 093                scope.Start();
 94                try
 95                {
 096                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 097                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 98                }
 099                catch (Exception e)
 100                {
 0101                    scope.Failed(e);
 0102                    throw;
 103                }
 0104            }
 105            async Task<Page<PrivateEndpoint>> NextPageFunc(string nextLink, int? pageSizeHint)
 106            {
 0107                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.List");
 0108                scope.Start();
 109                try
 110                {
 0111                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 0112                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 113                }
 0114                catch (Exception e)
 115                {
 0116                    scope.Failed(e);
 0117                    throw;
 118                }
 0119            }
 0120            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 121        }
 122
 123        /// <summary> Gets all private endpoints in a resource group. </summary>
 124        /// <param name="resourceGroupName"> The name of the resource group. </param>
 125        /// <param name="cancellationToken"> The cancellation token to use. </param>
 126        public virtual Pageable<PrivateEndpoint> List(string resourceGroupName, CancellationToken cancellationToken = de
 127        {
 0128            if (resourceGroupName == null)
 129            {
 0130                throw new ArgumentNullException(nameof(resourceGroupName));
 131            }
 132
 133            Page<PrivateEndpoint> FirstPageFunc(int? pageSizeHint)
 134            {
 0135                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.List");
 0136                scope.Start();
 137                try
 138                {
 0139                    var response = RestClient.List(resourceGroupName, cancellationToken);
 0140                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 141                }
 0142                catch (Exception e)
 143                {
 0144                    scope.Failed(e);
 0145                    throw;
 146                }
 0147            }
 148            Page<PrivateEndpoint> NextPageFunc(string nextLink, int? pageSizeHint)
 149            {
 0150                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.List");
 0151                scope.Start();
 152                try
 153                {
 0154                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
 0155                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 156                }
 0157                catch (Exception e)
 158                {
 0159                    scope.Failed(e);
 0160                    throw;
 161                }
 0162            }
 0163            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 164        }
 165
 166        /// <summary> Gets all private endpoints in a subscription. </summary>
 167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 168        public virtual AsyncPageable<PrivateEndpoint> ListBySubscriptionAsync(CancellationToken cancellationToken = defa
 169        {
 170            async Task<Page<PrivateEndpoint>> FirstPageFunc(int? pageSizeHint)
 171            {
 0172                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.ListBySubscription");
 0173                scope.Start();
 174                try
 175                {
 0176                    var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
 0177                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 178                }
 0179                catch (Exception e)
 180                {
 0181                    scope.Failed(e);
 0182                    throw;
 183                }
 0184            }
 185            async Task<Page<PrivateEndpoint>> NextPageFunc(string nextLink, int? pageSizeHint)
 186            {
 0187                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.ListBySubscription");
 0188                scope.Start();
 189                try
 190                {
 0191                    var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, cancellationToken).Configu
 0192                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 193                }
 0194                catch (Exception e)
 195                {
 0196                    scope.Failed(e);
 0197                    throw;
 198                }
 0199            }
 0200            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 201        }
 202
 203        /// <summary> Gets all private endpoints in a subscription. </summary>
 204        /// <param name="cancellationToken"> The cancellation token to use. </param>
 205        public virtual Pageable<PrivateEndpoint> ListBySubscription(CancellationToken cancellationToken = default)
 206        {
 207            Page<PrivateEndpoint> FirstPageFunc(int? pageSizeHint)
 208            {
 0209                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.ListBySubscription");
 0210                scope.Start();
 211                try
 212                {
 0213                    var response = RestClient.ListBySubscription(cancellationToken);
 0214                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 215                }
 0216                catch (Exception e)
 217                {
 0218                    scope.Failed(e);
 0219                    throw;
 220                }
 0221            }
 222            Page<PrivateEndpoint> NextPageFunc(string nextLink, int? pageSizeHint)
 223            {
 0224                using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.ListBySubscription");
 0225                scope.Start();
 226                try
 227                {
 0228                    var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken);
 0229                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 230                }
 0231                catch (Exception e)
 232                {
 0233                    scope.Failed(e);
 0234                    throw;
 235                }
 0236            }
 0237            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 238        }
 239
 240        /// <summary> Deletes the specified private endpoint. </summary>
 241        /// <param name="resourceGroupName"> The name of the resource group. </param>
 242        /// <param name="privateEndpointName"> The name of the private endpoint. </param>
 243        /// <param name="cancellationToken"> The cancellation token to use. </param>
 244        public virtual async Task<PrivateEndpointsDeleteOperation> StartDeleteAsync(string resourceGroupName, string pri
 245        {
 0246            if (resourceGroupName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(resourceGroupName));
 249            }
 0250            if (privateEndpointName == null)
 251            {
 0252                throw new ArgumentNullException(nameof(privateEndpointName));
 253            }
 254
 0255            using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.StartDelete");
 0256            scope.Start();
 257            try
 258            {
 0259                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, privateEndpointName, cancellation
 0260                return new PrivateEndpointsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest
 261            }
 0262            catch (Exception e)
 263            {
 0264                scope.Failed(e);
 0265                throw;
 266            }
 0267        }
 268
 269        /// <summary> Deletes the specified private endpoint. </summary>
 270        /// <param name="resourceGroupName"> The name of the resource group. </param>
 271        /// <param name="privateEndpointName"> The name of the private endpoint. </param>
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public virtual PrivateEndpointsDeleteOperation StartDelete(string resourceGroupName, string privateEndpointName,
 274        {
 0275            if (resourceGroupName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(resourceGroupName));
 278            }
 0279            if (privateEndpointName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(privateEndpointName));
 282            }
 283
 0284            using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.StartDelete");
 0285            scope.Start();
 286            try
 287            {
 0288                var originalResponse = RestClient.Delete(resourceGroupName, privateEndpointName, cancellationToken);
 0289                return new PrivateEndpointsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest
 290            }
 0291            catch (Exception e)
 292            {
 0293                scope.Failed(e);
 0294                throw;
 295            }
 0296        }
 297
 298        /// <summary> Creates or updates an private endpoint in the specified resource group. </summary>
 299        /// <param name="resourceGroupName"> The name of the resource group. </param>
 300        /// <param name="privateEndpointName"> The name of the private endpoint. </param>
 301        /// <param name="parameters"> Parameters supplied to the create or update private endpoint operation. </param>
 302        /// <param name="cancellationToken"> The cancellation token to use. </param>
 303        public virtual async Task<PrivateEndpointsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroup
 304        {
 0305            if (resourceGroupName == null)
 306            {
 0307                throw new ArgumentNullException(nameof(resourceGroupName));
 308            }
 0309            if (privateEndpointName == null)
 310            {
 0311                throw new ArgumentNullException(nameof(privateEndpointName));
 312            }
 0313            if (parameters == null)
 314            {
 0315                throw new ArgumentNullException(nameof(parameters));
 316            }
 317
 0318            using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.StartCreateOrUpdate");
 0319            scope.Start();
 320            try
 321            {
 0322                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, privateEndpointName, para
 0323                return new PrivateEndpointsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreat
 324            }
 0325            catch (Exception e)
 326            {
 0327                scope.Failed(e);
 0328                throw;
 329            }
 0330        }
 331
 332        /// <summary> Creates or updates an private endpoint in the specified resource group. </summary>
 333        /// <param name="resourceGroupName"> The name of the resource group. </param>
 334        /// <param name="privateEndpointName"> The name of the private endpoint. </param>
 335        /// <param name="parameters"> Parameters supplied to the create or update private endpoint operation. </param>
 336        /// <param name="cancellationToken"> The cancellation token to use. </param>
 337        public virtual PrivateEndpointsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string priv
 338        {
 0339            if (resourceGroupName == null)
 340            {
 0341                throw new ArgumentNullException(nameof(resourceGroupName));
 342            }
 0343            if (privateEndpointName == null)
 344            {
 0345                throw new ArgumentNullException(nameof(privateEndpointName));
 346            }
 0347            if (parameters == null)
 348            {
 0349                throw new ArgumentNullException(nameof(parameters));
 350            }
 351
 0352            using var scope = _clientDiagnostics.CreateScope("PrivateEndpointsOperations.StartCreateOrUpdate");
 0353            scope.Start();
 354            try
 355            {
 0356                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, privateEndpointName, parameters, can
 0357                return new PrivateEndpointsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreat
 358            }
 0359            catch (Exception e)
 360            {
 0361                scope.Failed(e);
 0362                throw;
 363            }
 0364        }
 365    }
 366}