< Summary

Class:Azure.ResourceManager.Network.PublicIPPrefixesOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\PublicIPPrefixesOperations.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%
<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%
StartCreateOrUpdateAsync()-0%0%
StartCreateOrUpdate(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\PublicIPPrefixesOperations.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 PublicIPPrefixes service client. </summary>
 19    public partial class PublicIPPrefixesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal PublicIPPrefixesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of PublicIPPrefixesOperations for mocking. </summary>
 025        protected PublicIPPrefixesOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of PublicIPPrefixesOperations. </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 PublicIPPrefixesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript
 34        {
 035            RestClient = new PublicIPPrefixesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the specified public IP prefix in a specified resource group. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="publicIpPrefixName"> 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<PublicIPPrefix>> GetAsync(string resourceGroupName, string publicIpPrefixName
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.Get");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.GetAsync(resourceGroupName, publicIpPrefixName, expand, cancellationToken).Confi
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Gets the specified public IP prefix in a specified resource group. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="publicIpPrefixName"> 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<PublicIPPrefix> Get(string resourceGroupName, string publicIpPrefixName, string expand =
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.Get");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Get(resourceGroupName, publicIpPrefixName, expand, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Updates public IP prefix tags. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param>
 83        /// <param name="parameters"> Parameters supplied to update public IP prefix tags. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<PublicIPPrefix>> UpdateTagsAsync(string resourceGroupName, string publicIpPre
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.UpdateTags");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.UpdateTagsAsync(resourceGroupName, publicIpPrefixName, parameters, cancellationT
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Updates public IP prefix tags. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param>
 103        /// <param name="parameters"> Parameters supplied to update public IP prefix tags. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<PublicIPPrefix> UpdateTags(string resourceGroupName, string publicIpPrefixName, TagsObje
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.UpdateTags");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.UpdateTags(resourceGroupName, publicIpPrefixName, parameters, cancellationToken);
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Gets all the public IP prefixes in a subscription. </summary>
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public virtual AsyncPageable<PublicIPPrefix> ListAllAsync(CancellationToken cancellationToken = default)
 123        {
 124            async Task<Page<PublicIPPrefix>> FirstPageFunc(int? pageSizeHint)
 125            {
 0126                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll");
 0127                scope.Start();
 128                try
 129                {
 0130                    var response = await RestClient.ListAllAsync(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<PublicIPPrefix>> NextPageFunc(string nextLink, int? pageSizeHint)
 140            {
 0141                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll");
 0142                scope.Start();
 143                try
 144                {
 0145                    var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal
 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 public IP prefixes in a subscription. </summary>
 158        /// <param name="cancellationToken"> The cancellation token to use. </param>
 159        public virtual Pageable<PublicIPPrefix> ListAll(CancellationToken cancellationToken = default)
 160        {
 161            Page<PublicIPPrefix> FirstPageFunc(int? pageSizeHint)
 162            {
 0163                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll");
 0164                scope.Start();
 165                try
 166                {
 0167                    var response = RestClient.ListAll(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<PublicIPPrefix> NextPageFunc(string nextLink, int? pageSizeHint)
 177            {
 0178                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll");
 0179                scope.Start();
 180                try
 181                {
 0182                    var response = RestClient.ListAllNextPage(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 public IP prefixes 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<PublicIPPrefix> ListAsync(string resourceGroupName, CancellationToken cancellationT
 198        {
 0199            if (resourceGroupName == null)
 200            {
 0201                throw new ArgumentNullException(nameof(resourceGroupName));
 202            }
 203
 204            async Task<Page<PublicIPPrefix>> FirstPageFunc(int? pageSizeHint)
 205            {
 0206                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List");
 0207                scope.Start();
 208                try
 209                {
 0210                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 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<PublicIPPrefix>> NextPageFunc(string nextLink, int? pageSizeHint)
 220            {
 0221                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List");
 0222                scope.Start();
 223                try
 224                {
 0225                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 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 public IP prefixes 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<PublicIPPrefix> List(string resourceGroupName, CancellationToken cancellationToken = def
 241        {
 0242            if (resourceGroupName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(resourceGroupName));
 245            }
 246
 247            Page<PublicIPPrefix> FirstPageFunc(int? pageSizeHint)
 248            {
 0249                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List");
 0250                scope.Start();
 251                try
 252                {
 0253                    var response = RestClient.List(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<PublicIPPrefix> NextPageFunc(string nextLink, int? pageSizeHint)
 263            {
 0264                using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List");
 0265                scope.Start();
 266                try
 267                {
 0268                    var response = RestClient.ListNextPage(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 public IP prefix. </summary>
 281        /// <param name="resourceGroupName"> The name of the resource group. </param>
 282        /// <param name="publicIpPrefixName"> The name of the PublicIpPrefix. </param>
 283        /// <param name="cancellationToken"> The cancellation token to use. </param>
 284        public virtual async Task<PublicIPPrefixesDeleteOperation> StartDeleteAsync(string resourceGroupName, string pub
 285        {
 0286            if (resourceGroupName == null)
 287            {
 0288                throw new ArgumentNullException(nameof(resourceGroupName));
 289            }
 0290            if (publicIpPrefixName == null)
 291            {
 0292                throw new ArgumentNullException(nameof(publicIpPrefixName));
 293            }
 294
 0295            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartDelete");
 0296            scope.Start();
 297            try
 298            {
 0299                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, publicIpPrefixName, cancellationT
 0300                return new PublicIPPrefixesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest
 301            }
 0302            catch (Exception e)
 303            {
 0304                scope.Failed(e);
 0305                throw;
 306            }
 0307        }
 308
 309        /// <summary> Deletes the specified public IP prefix. </summary>
 310        /// <param name="resourceGroupName"> The name of the resource group. </param>
 311        /// <param name="publicIpPrefixName"> The name of the PublicIpPrefix. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public virtual PublicIPPrefixesDeleteOperation StartDelete(string resourceGroupName, string publicIpPrefixName, 
 314        {
 0315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 0319            if (publicIpPrefixName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(publicIpPrefixName));
 322            }
 323
 0324            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartDelete");
 0325            scope.Start();
 326            try
 327            {
 0328                var originalResponse = RestClient.Delete(resourceGroupName, publicIpPrefixName, cancellationToken);
 0329                return new PublicIPPrefixesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest
 330            }
 0331            catch (Exception e)
 332            {
 0333                scope.Failed(e);
 0334                throw;
 335            }
 0336        }
 337
 338        /// <summary> Creates or updates a static or dynamic public IP prefix. </summary>
 339        /// <param name="resourceGroupName"> The name of the resource group. </param>
 340        /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param>
 341        /// <param name="parameters"> Parameters supplied to the create or update public IP prefix operation. </param>
 342        /// <param name="cancellationToken"> The cancellation token to use. </param>
 343        public virtual async Task<PublicIPPrefixesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroup
 344        {
 0345            if (resourceGroupName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(resourceGroupName));
 348            }
 0349            if (publicIpPrefixName == null)
 350            {
 0351                throw new ArgumentNullException(nameof(publicIpPrefixName));
 352            }
 0353            if (parameters == null)
 354            {
 0355                throw new ArgumentNullException(nameof(parameters));
 356            }
 357
 0358            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartCreateOrUpdate");
 0359            scope.Start();
 360            try
 361            {
 0362                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, publicIpPrefixName, param
 0363                return new PublicIPPrefixesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreat
 364            }
 0365            catch (Exception e)
 366            {
 0367                scope.Failed(e);
 0368                throw;
 369            }
 0370        }
 371
 372        /// <summary> Creates or updates a static or dynamic public IP prefix. </summary>
 373        /// <param name="resourceGroupName"> The name of the resource group. </param>
 374        /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param>
 375        /// <param name="parameters"> Parameters supplied to the create or update public IP prefix operation. </param>
 376        /// <param name="cancellationToken"> The cancellation token to use. </param>
 377        public virtual PublicIPPrefixesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string publ
 378        {
 0379            if (resourceGroupName == null)
 380            {
 0381                throw new ArgumentNullException(nameof(resourceGroupName));
 382            }
 0383            if (publicIpPrefixName == null)
 384            {
 0385                throw new ArgumentNullException(nameof(publicIpPrefixName));
 386            }
 0387            if (parameters == null)
 388            {
 0389                throw new ArgumentNullException(nameof(parameters));
 390            }
 391
 0392            using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartCreateOrUpdate");
 0393            scope.Start();
 394            try
 395            {
 0396                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, publicIpPrefixName, parameters, canc
 0397                return new PublicIPPrefixesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreat
 398            }
 0399            catch (Exception e)
 400            {
 0401                scope.Failed(e);
 0402                throw;
 403            }
 0404        }
 405    }
 406}