< Summary

Class:Azure.ResourceManager.Network.ServiceEndpointPoliciesOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\ServiceEndpointPoliciesOperations.cs
Covered lines:0
Uncovered lines:160
Coverable lines:160
Total lines:406
Line coverage:0% (0 of 160)
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%
UpdateTagsAsync()-0%100%
UpdateTags(...)-0%100%
<ListAsync()-0%100%
<ListAsync()-0%100%
ListAsync(...)-0%100%
List(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%
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\ServiceEndpointPoliciesOperations.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 ServiceEndpointPolicies service client. </summary>
 19    public partial class ServiceEndpointPoliciesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal ServiceEndpointPoliciesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ServiceEndpointPoliciesOperations for mocking. </summary>
 025        protected ServiceEndpointPoliciesOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of ServiceEndpointPoliciesOperations. </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 ServiceEndpointPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string su
 34        {
 035            RestClient = new ServiceEndpointPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the specified service Endpoint Policies in a specified resource group. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </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<ServiceEndpointPolicy>> GetAsync(string resourceGroupName, string serviceEndp
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.Get");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.GetAsync(resourceGroupName, serviceEndpointPolicyName, expand, cancellationToken
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Gets the specified service Endpoint Policies in a specified resource group. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 63        /// <param name="expand"> Expands referenced resources. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<ServiceEndpointPolicy> Get(string resourceGroupName, string serviceEndpointPolicyName, s
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.Get");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Get(resourceGroupName, serviceEndpointPolicyName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Updates tags of a service endpoint policy. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 83        /// <param name="parameters"> Parameters supplied to update service endpoint policy tags. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<ServiceEndpointPolicy>> UpdateTagsAsync(string resourceGroupName, string serv
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.UpdateTags");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.UpdateTagsAsync(resourceGroupName, serviceEndpointPolicyName, parameters, cancel
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Updates tags of a service endpoint policy. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 103        /// <param name="parameters"> Parameters supplied to update service endpoint policy tags. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<ServiceEndpointPolicy> UpdateTags(string resourceGroupName, string serviceEndpointPolicy
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.UpdateTags");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.UpdateTags(resourceGroupName, serviceEndpointPolicyName, parameters, cancellationToken
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Gets all the service endpoint policies in a subscription. </summary>
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public virtual AsyncPageable<ServiceEndpointPolicy> ListAsync(CancellationToken cancellationToken = default)
 123        {
 124            async Task<Page<ServiceEndpointPolicy>> FirstPageFunc(int? pageSizeHint)
 125            {
 0126                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.List");
 0127                scope.Start();
 128                try
 129                {
 0130                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 0131                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 132                }
 0133                catch (Exception e)
 134                {
 0135                    scope.Failed(e);
 0136                    throw;
 137                }
 0138            }
 139            async Task<Page<ServiceEndpointPolicy>> NextPageFunc(string nextLink, int? pageSizeHint)
 140            {
 0141                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.List");
 0142                scope.Start();
 143                try
 144                {
 0145                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0146                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 147                }
 0148                catch (Exception e)
 149                {
 0150                    scope.Failed(e);
 0151                    throw;
 152                }
 0153            }
 0154            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 155        }
 156
 157        /// <summary> Gets all the service endpoint policies in a subscription. </summary>
 158        /// <param name="cancellationToken"> The cancellation token to use. </param>
 159        public virtual Pageable<ServiceEndpointPolicy> List(CancellationToken cancellationToken = default)
 160        {
 161            Page<ServiceEndpointPolicy> FirstPageFunc(int? pageSizeHint)
 162            {
 0163                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.List");
 0164                scope.Start();
 165                try
 166                {
 0167                    var response = RestClient.List(cancellationToken);
 0168                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 169                }
 0170                catch (Exception e)
 171                {
 0172                    scope.Failed(e);
 0173                    throw;
 174                }
 0175            }
 176            Page<ServiceEndpointPolicy> NextPageFunc(string nextLink, int? pageSizeHint)
 177            {
 0178                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.List");
 0179                scope.Start();
 180                try
 181                {
 0182                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0183                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 184                }
 0185                catch (Exception e)
 186                {
 0187                    scope.Failed(e);
 0188                    throw;
 189                }
 0190            }
 0191            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 192        }
 193
 194        /// <summary> Gets all service endpoint Policies in a resource group. </summary>
 195        /// <param name="resourceGroupName"> The name of the resource group. </param>
 196        /// <param name="cancellationToken"> The cancellation token to use. </param>
 197        public virtual AsyncPageable<ServiceEndpointPolicy> ListByResourceGroupAsync(string resourceGroupName, Cancellat
 198        {
 0199            if (resourceGroupName == null)
 200            {
 0201                throw new ArgumentNullException(nameof(resourceGroupName));
 202            }
 203
 204            async Task<Page<ServiceEndpointPolicy>> FirstPageFunc(int? pageSizeHint)
 205            {
 0206                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.ListByResourceGroup"
 0207                scope.Start();
 208                try
 209                {
 0210                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0211                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 212                }
 0213                catch (Exception e)
 214                {
 0215                    scope.Failed(e);
 0216                    throw;
 217                }
 0218            }
 219            async Task<Page<ServiceEndpointPolicy>> NextPageFunc(string nextLink, int? pageSizeHint)
 220            {
 0221                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.ListByResourceGroup"
 0222                scope.Start();
 223                try
 224                {
 0225                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0226                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 227                }
 0228                catch (Exception e)
 229                {
 0230                    scope.Failed(e);
 0231                    throw;
 232                }
 0233            }
 0234            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 235        }
 236
 237        /// <summary> Gets all service endpoint Policies in a resource group. </summary>
 238        /// <param name="resourceGroupName"> The name of the resource group. </param>
 239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 240        public virtual Pageable<ServiceEndpointPolicy> ListByResourceGroup(string resourceGroupName, CancellationToken c
 241        {
 0242            if (resourceGroupName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(resourceGroupName));
 245            }
 246
 247            Page<ServiceEndpointPolicy> FirstPageFunc(int? pageSizeHint)
 248            {
 0249                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.ListByResourceGroup"
 0250                scope.Start();
 251                try
 252                {
 0253                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0254                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 255                }
 0256                catch (Exception e)
 257                {
 0258                    scope.Failed(e);
 0259                    throw;
 260                }
 0261            }
 262            Page<ServiceEndpointPolicy> NextPageFunc(string nextLink, int? pageSizeHint)
 263            {
 0264                using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.ListByResourceGroup"
 0265                scope.Start();
 266                try
 267                {
 0268                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0269                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 270                }
 0271                catch (Exception e)
 272                {
 0273                    scope.Failed(e);
 0274                    throw;
 275                }
 0276            }
 0277            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 278        }
 279
 280        /// <summary> Deletes the specified service endpoint policy. </summary>
 281        /// <param name="resourceGroupName"> The name of the resource group. </param>
 282        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 283        /// <param name="cancellationToken"> The cancellation token to use. </param>
 284        public virtual async Task<ServiceEndpointPoliciesDeleteOperation> StartDeleteAsync(string resourceGroupName, str
 285        {
 0286            if (resourceGroupName == null)
 287            {
 0288                throw new ArgumentNullException(nameof(resourceGroupName));
 289            }
 0290            if (serviceEndpointPolicyName == null)
 291            {
 0292                throw new ArgumentNullException(nameof(serviceEndpointPolicyName));
 293            }
 294
 0295            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.StartDelete");
 0296            scope.Start();
 297            try
 298            {
 0299                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, serviceEndpointPolicyName, cancel
 0300                return new ServiceEndpointPoliciesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDelete
 301            }
 0302            catch (Exception e)
 303            {
 0304                scope.Failed(e);
 0305                throw;
 306            }
 0307        }
 308
 309        /// <summary> Deletes the specified service endpoint policy. </summary>
 310        /// <param name="resourceGroupName"> The name of the resource group. </param>
 311        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public virtual ServiceEndpointPoliciesDeleteOperation StartDelete(string resourceGroupName, string serviceEndpoi
 314        {
 0315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 0319            if (serviceEndpointPolicyName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(serviceEndpointPolicyName));
 322            }
 323
 0324            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.StartDelete");
 0325            scope.Start();
 326            try
 327            {
 0328                var originalResponse = RestClient.Delete(resourceGroupName, serviceEndpointPolicyName, cancellationToken
 0329                return new ServiceEndpointPoliciesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDelete
 330            }
 0331            catch (Exception e)
 332            {
 0333                scope.Failed(e);
 0334                throw;
 335            }
 0336        }
 337
 338        /// <summary> Creates or updates a service Endpoint Policies. </summary>
 339        /// <param name="resourceGroupName"> The name of the resource group. </param>
 340        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 341        /// <param name="parameters"> Parameters supplied to the create or update service endpoint policy operation. </p
 342        /// <param name="cancellationToken"> The cancellation token to use. </param>
 343        public virtual async Task<ServiceEndpointPoliciesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resour
 344        {
 0345            if (resourceGroupName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(resourceGroupName));
 348            }
 0349            if (serviceEndpointPolicyName == null)
 350            {
 0351                throw new ArgumentNullException(nameof(serviceEndpointPolicyName));
 352            }
 0353            if (parameters == null)
 354            {
 0355                throw new ArgumentNullException(nameof(parameters));
 356            }
 357
 0358            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.StartCreateOrUpdate");
 0359            scope.Start();
 360            try
 361            {
 0362                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serviceEndpointPolicyName
 0363                return new ServiceEndpointPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Crea
 364            }
 0365            catch (Exception e)
 366            {
 0367                scope.Failed(e);
 0368                throw;
 369            }
 0370        }
 371
 372        /// <summary> Creates or updates a service Endpoint Policies. </summary>
 373        /// <param name="resourceGroupName"> The name of the resource group. </param>
 374        /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param>
 375        /// <param name="parameters"> Parameters supplied to the create or update service endpoint policy operation. </p
 376        /// <param name="cancellationToken"> The cancellation token to use. </param>
 377        public virtual ServiceEndpointPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, stri
 378        {
 0379            if (resourceGroupName == null)
 380            {
 0381                throw new ArgumentNullException(nameof(resourceGroupName));
 382            }
 0383            if (serviceEndpointPolicyName == null)
 384            {
 0385                throw new ArgumentNullException(nameof(serviceEndpointPolicyName));
 386            }
 0387            if (parameters == null)
 388            {
 0389                throw new ArgumentNullException(nameof(parameters));
 390            }
 391
 0392            using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesOperations.StartCreateOrUpdate");
 0393            scope.Start();
 394            try
 395            {
 0396                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serviceEndpointPolicyName, parameter
 0397                return new ServiceEndpointPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Crea
 398            }
 0399            catch (Exception e)
 400            {
 0401                scope.Failed(e);
 0402                throw;
 403            }
 0404        }
 405    }
 406}