< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
GetAsync()-0%100%
Get(...)-0%100%
CreateOrUpdateAsync()-0%100%
CreateOrUpdate(...)-0%100%
UpdateTagsAsync()-0%100%
UpdateTags(...)-0%100%
<ListAllAsync()-0%100%
<ListAllAsync()-0%100%
ListAllAsync(...)-0%100%
ListAll(...)-0%100%
ListAsync(...)-0%0%
<ListAsync()-0%100%
<ListAsync()-0%100%
List(...)-0%0%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\NetworkProfilesOperations.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 NetworkProfiles service client. </summary>
 19    public partial class NetworkProfilesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal NetworkProfilesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of NetworkProfilesOperations for mocking. </summary>
 025        protected NetworkProfilesOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of NetworkProfilesOperations. </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 NetworkProfilesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti
 34        {
 035            RestClient = new NetworkProfilesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the specified network profile in a specified resource group. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="networkProfileName"> The name of the public IP prefix. </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<NetworkProfile>> GetAsync(string resourceGroupName, string networkProfileName
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.Get");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.GetAsync(resourceGroupName, networkProfileName, expand, cancellationToken).Confi
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Gets the specified network profile in a specified resource group. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="networkProfileName"> The name of the public IP prefix. </param>
 63        /// <param name="expand"> Expands referenced resources. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<NetworkProfile> Get(string resourceGroupName, string networkProfileName, string expand =
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.Get");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Get(resourceGroupName, networkProfileName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Creates or updates a network profile. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="networkProfileName"> The name of the network profile. </param>
 83        /// <param name="parameters"> Parameters supplied to the create or update network profile operation. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<NetworkProfile>> CreateOrUpdateAsync(string resourceGroupName, string network
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.CreateOrUpdate");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.CreateOrUpdateAsync(resourceGroupName, networkProfileName, parameters, cancellat
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Creates or updates a network profile. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="networkProfileName"> The name of the network profile. </param>
 103        /// <param name="parameters"> Parameters supplied to the create or update network profile operation. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<NetworkProfile> CreateOrUpdate(string resourceGroupName, string networkProfileName, Netw
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.CreateOrUpdate");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.CreateOrUpdate(resourceGroupName, networkProfileName, parameters, cancellationToken);
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Updates network profile tags. </summary>
 121        /// <param name="resourceGroupName"> The name of the resource group. </param>
 122        /// <param name="networkProfileName"> The name of the network profile. </param>
 123        /// <param name="parameters"> Parameters supplied to update network profile tags. </param>
 124        /// <param name="cancellationToken"> The cancellation token to use. </param>
 125        public virtual async Task<Response<NetworkProfile>> UpdateTagsAsync(string resourceGroupName, string networkProf
 126        {
 0127            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.UpdateTags");
 0128            scope.Start();
 129            try
 130            {
 0131                return await RestClient.UpdateTagsAsync(resourceGroupName, networkProfileName, parameters, cancellationT
 132            }
 0133            catch (Exception e)
 134            {
 0135                scope.Failed(e);
 0136                throw;
 137            }
 0138        }
 139
 140        /// <summary> Updates network profile tags. </summary>
 141        /// <param name="resourceGroupName"> The name of the resource group. </param>
 142        /// <param name="networkProfileName"> The name of the network profile. </param>
 143        /// <param name="parameters"> Parameters supplied to update network profile tags. </param>
 144        /// <param name="cancellationToken"> The cancellation token to use. </param>
 145        public virtual Response<NetworkProfile> UpdateTags(string resourceGroupName, string networkProfileName, TagsObje
 146        {
 0147            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.UpdateTags");
 0148            scope.Start();
 149            try
 150            {
 0151                return RestClient.UpdateTags(resourceGroupName, networkProfileName, parameters, cancellationToken);
 152            }
 0153            catch (Exception e)
 154            {
 0155                scope.Failed(e);
 0156                throw;
 157            }
 0158        }
 159
 160        /// <summary> Gets all the network profiles in a subscription. </summary>
 161        /// <param name="cancellationToken"> The cancellation token to use. </param>
 162        public virtual AsyncPageable<NetworkProfile> ListAllAsync(CancellationToken cancellationToken = default)
 163        {
 164            async Task<Page<NetworkProfile>> FirstPageFunc(int? pageSizeHint)
 165            {
 0166                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.ListAll");
 0167                scope.Start();
 168                try
 169                {
 0170                    var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false);
 0171                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 172                }
 0173                catch (Exception e)
 174                {
 0175                    scope.Failed(e);
 0176                    throw;
 177                }
 0178            }
 179            async Task<Page<NetworkProfile>> NextPageFunc(string nextLink, int? pageSizeHint)
 180            {
 0181                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.ListAll");
 0182                scope.Start();
 183                try
 184                {
 0185                    var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal
 0186                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 187                }
 0188                catch (Exception e)
 189                {
 0190                    scope.Failed(e);
 0191                    throw;
 192                }
 0193            }
 0194            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 195        }
 196
 197        /// <summary> Gets all the network profiles in a subscription. </summary>
 198        /// <param name="cancellationToken"> The cancellation token to use. </param>
 199        public virtual Pageable<NetworkProfile> ListAll(CancellationToken cancellationToken = default)
 200        {
 201            Page<NetworkProfile> FirstPageFunc(int? pageSizeHint)
 202            {
 0203                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.ListAll");
 0204                scope.Start();
 205                try
 206                {
 0207                    var response = RestClient.ListAll(cancellationToken);
 0208                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 209                }
 0210                catch (Exception e)
 211                {
 0212                    scope.Failed(e);
 0213                    throw;
 214                }
 0215            }
 216            Page<NetworkProfile> NextPageFunc(string nextLink, int? pageSizeHint)
 217            {
 0218                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.ListAll");
 0219                scope.Start();
 220                try
 221                {
 0222                    var response = RestClient.ListAllNextPage(nextLink, cancellationToken);
 0223                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 224                }
 0225                catch (Exception e)
 226                {
 0227                    scope.Failed(e);
 0228                    throw;
 229                }
 0230            }
 0231            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 232        }
 233
 234        /// <summary> Gets all network profiles in a resource group. </summary>
 235        /// <param name="resourceGroupName"> The name of the resource group. </param>
 236        /// <param name="cancellationToken"> The cancellation token to use. </param>
 237        public virtual AsyncPageable<NetworkProfile> ListAsync(string resourceGroupName, CancellationToken cancellationT
 238        {
 0239            if (resourceGroupName == null)
 240            {
 0241                throw new ArgumentNullException(nameof(resourceGroupName));
 242            }
 243
 244            async Task<Page<NetworkProfile>> FirstPageFunc(int? pageSizeHint)
 245            {
 0246                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.List");
 0247                scope.Start();
 248                try
 249                {
 0250                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 0251                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 252                }
 0253                catch (Exception e)
 254                {
 0255                    scope.Failed(e);
 0256                    throw;
 257                }
 0258            }
 259            async Task<Page<NetworkProfile>> NextPageFunc(string nextLink, int? pageSizeHint)
 260            {
 0261                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.List");
 0262                scope.Start();
 263                try
 264                {
 0265                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 0266                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 267                }
 0268                catch (Exception e)
 269                {
 0270                    scope.Failed(e);
 0271                    throw;
 272                }
 0273            }
 0274            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 275        }
 276
 277        /// <summary> Gets all network profiles in a resource group. </summary>
 278        /// <param name="resourceGroupName"> The name of the resource group. </param>
 279        /// <param name="cancellationToken"> The cancellation token to use. </param>
 280        public virtual Pageable<NetworkProfile> List(string resourceGroupName, CancellationToken cancellationToken = def
 281        {
 0282            if (resourceGroupName == null)
 283            {
 0284                throw new ArgumentNullException(nameof(resourceGroupName));
 285            }
 286
 287            Page<NetworkProfile> FirstPageFunc(int? pageSizeHint)
 288            {
 0289                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.List");
 0290                scope.Start();
 291                try
 292                {
 0293                    var response = RestClient.List(resourceGroupName, cancellationToken);
 0294                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 295                }
 0296                catch (Exception e)
 297                {
 0298                    scope.Failed(e);
 0299                    throw;
 300                }
 0301            }
 302            Page<NetworkProfile> NextPageFunc(string nextLink, int? pageSizeHint)
 303            {
 0304                using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.List");
 0305                scope.Start();
 306                try
 307                {
 0308                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
 0309                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 310                }
 0311                catch (Exception e)
 312                {
 0313                    scope.Failed(e);
 0314                    throw;
 315                }
 0316            }
 0317            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 318        }
 319
 320        /// <summary> Deletes the specified network profile. </summary>
 321        /// <param name="resourceGroupName"> The name of the resource group. </param>
 322        /// <param name="networkProfileName"> The name of the NetworkProfile. </param>
 323        /// <param name="cancellationToken"> The cancellation token to use. </param>
 324        public virtual async Task<NetworkProfilesDeleteOperation> StartDeleteAsync(string resourceGroupName, string netw
 325        {
 0326            if (resourceGroupName == null)
 327            {
 0328                throw new ArgumentNullException(nameof(resourceGroupName));
 329            }
 0330            if (networkProfileName == null)
 331            {
 0332                throw new ArgumentNullException(nameof(networkProfileName));
 333            }
 334
 0335            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.StartDelete");
 0336            scope.Start();
 337            try
 338            {
 0339                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkProfileName, cancellationT
 0340                return new NetworkProfilesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(
 341            }
 0342            catch (Exception e)
 343            {
 0344                scope.Failed(e);
 0345                throw;
 346            }
 0347        }
 348
 349        /// <summary> Deletes the specified network profile. </summary>
 350        /// <param name="resourceGroupName"> The name of the resource group. </param>
 351        /// <param name="networkProfileName"> The name of the NetworkProfile. </param>
 352        /// <param name="cancellationToken"> The cancellation token to use. </param>
 353        public virtual NetworkProfilesDeleteOperation StartDelete(string resourceGroupName, string networkProfileName, C
 354        {
 0355            if (resourceGroupName == null)
 356            {
 0357                throw new ArgumentNullException(nameof(resourceGroupName));
 358            }
 0359            if (networkProfileName == null)
 360            {
 0361                throw new ArgumentNullException(nameof(networkProfileName));
 362            }
 363
 0364            using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.StartDelete");
 0365            scope.Start();
 366            try
 367            {
 0368                var originalResponse = RestClient.Delete(resourceGroupName, networkProfileName, cancellationToken);
 0369                return new NetworkProfilesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(
 370            }
 0371            catch (Exception e)
 372            {
 0373                scope.Failed(e);
 0374                throw;
 375            }
 0376        }
 377    }
 378}