< Summary

Class:Azure.ResourceManager.Resources.TagsOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\TagsOperations.cs
Covered lines:90
Uncovered lines:64
Coverable lines:154
Total lines:410
Line coverage:58.4% (90 of 154)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
DeleteValueAsync()-57.14%100%
DeleteValue(...)-57.14%100%
CreateOrUpdateValueAsync()-100%100%
CreateOrUpdateValue(...)-100%100%
CreateOrUpdateAsync()-57.14%100%
CreateOrUpdate(...)-57.14%100%
DeleteAsync()-57.14%100%
Delete(...)-57.14%100%
CreateOrUpdateAtScopeAsync()-57.14%100%
CreateOrUpdateAtScope(...)-57.14%100%
UpdateAtScopeAsync()-57.14%100%
UpdateAtScope(...)-57.14%100%
GetAtScopeAsync()-57.14%100%
GetAtScope(...)-57.14%100%
DeleteAtScopeAsync()-57.14%100%
DeleteAtScope(...)-57.14%100%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
ListAsync(...)-100%100%
List(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\TagsOperations.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.Resources.Models;
 15
 16namespace Azure.ResourceManager.Resources
 17{
 18    /// <summary> The Tags service client. </summary>
 19    public partial class TagsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 11623        internal TagsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of TagsOperations for mocking. </summary>
 25625        protected TagsOperations()
 26        {
 25627        }
 28        /// <summary> Initializes a new instance of TagsOperations. </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 ID of the target subscription. </param>
 32        /// <param name="endpoint"> server parameter. </param>
 25633        internal TagsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri e
 34        {
 25635            RestClient = new TagsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 25636            _clientDiagnostics = clientDiagnostics;
 25637            _pipeline = pipeline;
 25638        }
 39
 40        /// <summary> This operation allows deleting a value from the list of predefined values for an existing predefin
 41        /// <param name="tagName"> The name of the tag. </param>
 42        /// <param name="tagValue"> The value of the tag to delete. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response> DeleteValueAsync(string tagName, string tagValue, CancellationToken cancella
 45        {
 246            using var scope = _clientDiagnostics.CreateScope("TagsOperations.DeleteValue");
 247            scope.Start();
 48            try
 49            {
 250                return await RestClient.DeleteValueAsync(tagName, tagValue, cancellationToken).ConfigureAwait(false);
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 257        }
 58
 59        /// <summary> This operation allows deleting a value from the list of predefined values for an existing predefin
 60        /// <param name="tagName"> The name of the tag. </param>
 61        /// <param name="tagValue"> The value of the tag to delete. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response DeleteValue(string tagName, string tagValue, CancellationToken cancellationToken = defau
 64        {
 265            using var scope = _clientDiagnostics.CreateScope("TagsOperations.DeleteValue");
 266            scope.Start();
 67            try
 68            {
 269                return RestClient.DeleteValue(tagName, tagValue, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 276        }
 77
 78        /// <summary> This operation allows adding a value to the list of predefined values for an existing predefined t
 79        /// <param name="tagName"> The name of the tag. </param>
 80        /// <param name="tagValue"> The value of the tag to create. </param>
 81        /// <param name="cancellationToken"> The cancellation token to use. </param>
 82        public virtual async Task<Response<TagValue>> CreateOrUpdateValueAsync(string tagName, string tagValue, Cancella
 83        {
 484            using var scope = _clientDiagnostics.CreateScope("TagsOperations.CreateOrUpdateValue");
 485            scope.Start();
 86            try
 87            {
 488                return await RestClient.CreateOrUpdateValueAsync(tagName, tagValue, cancellationToken).ConfigureAwait(fa
 89            }
 290            catch (Exception e)
 91            {
 292                scope.Failed(e);
 293                throw;
 94            }
 295        }
 96
 97        /// <summary> This operation allows adding a value to the list of predefined values for an existing predefined t
 98        /// <param name="tagName"> The name of the tag. </param>
 99        /// <param name="tagValue"> The value of the tag to create. </param>
 100        /// <param name="cancellationToken"> The cancellation token to use. </param>
 101        public virtual Response<TagValue> CreateOrUpdateValue(string tagName, string tagValue, CancellationToken cancell
 102        {
 4103            using var scope = _clientDiagnostics.CreateScope("TagsOperations.CreateOrUpdateValue");
 4104            scope.Start();
 105            try
 106            {
 4107                return RestClient.CreateOrUpdateValue(tagName, tagValue, cancellationToken);
 108            }
 2109            catch (Exception e)
 110            {
 2111                scope.Failed(e);
 2112                throw;
 113            }
 2114        }
 115
 116        /// <summary> This operation allows adding a name to the list of predefined tag names for the given subscription
 117        /// <param name="tagName"> The name of the tag to create. </param>
 118        /// <param name="cancellationToken"> The cancellation token to use. </param>
 119        public virtual async Task<Response<TagDetails>> CreateOrUpdateAsync(string tagName, CancellationToken cancellati
 120        {
 4121            using var scope = _clientDiagnostics.CreateScope("TagsOperations.CreateOrUpdate");
 4122            scope.Start();
 123            try
 124            {
 4125                return await RestClient.CreateOrUpdateAsync(tagName, cancellationToken).ConfigureAwait(false);
 126            }
 0127            catch (Exception e)
 128            {
 0129                scope.Failed(e);
 0130                throw;
 131            }
 4132        }
 133
 134        /// <summary> This operation allows adding a name to the list of predefined tag names for the given subscription
 135        /// <param name="tagName"> The name of the tag to create. </param>
 136        /// <param name="cancellationToken"> The cancellation token to use. </param>
 137        public virtual Response<TagDetails> CreateOrUpdate(string tagName, CancellationToken cancellationToken = default
 138        {
 4139            using var scope = _clientDiagnostics.CreateScope("TagsOperations.CreateOrUpdate");
 4140            scope.Start();
 141            try
 142            {
 4143                return RestClient.CreateOrUpdate(tagName, cancellationToken);
 144            }
 0145            catch (Exception e)
 146            {
 0147                scope.Failed(e);
 0148                throw;
 149            }
 4150        }
 151
 152        /// <summary> This operation allows deleting a name from the list of predefined tag names for the given subscrip
 153        /// <param name="tagName"> The name of the tag. </param>
 154        /// <param name="cancellationToken"> The cancellation token to use. </param>
 155        public virtual async Task<Response> DeleteAsync(string tagName, CancellationToken cancellationToken = default)
 156        {
 4157            using var scope = _clientDiagnostics.CreateScope("TagsOperations.Delete");
 4158            scope.Start();
 159            try
 160            {
 4161                return await RestClient.DeleteAsync(tagName, cancellationToken).ConfigureAwait(false);
 162            }
 0163            catch (Exception e)
 164            {
 0165                scope.Failed(e);
 0166                throw;
 167            }
 4168        }
 169
 170        /// <summary> This operation allows deleting a name from the list of predefined tag names for the given subscrip
 171        /// <param name="tagName"> The name of the tag. </param>
 172        /// <param name="cancellationToken"> The cancellation token to use. </param>
 173        public virtual Response Delete(string tagName, CancellationToken cancellationToken = default)
 174        {
 4175            using var scope = _clientDiagnostics.CreateScope("TagsOperations.Delete");
 4176            scope.Start();
 177            try
 178            {
 4179                return RestClient.Delete(tagName, cancellationToken);
 180            }
 0181            catch (Exception e)
 182            {
 0183                scope.Failed(e);
 0184                throw;
 185            }
 4186        }
 187
 188        /// <summary> This operation allows adding or replacing the entire set of tags on the specified resource or subs
 189        /// <param name="scope"> The resource scope. </param>
 190        /// <param name="parameters"> The TagsResource to use. </param>
 191        /// <param name="cancellationToken"> The cancellation token to use. </param>
 192        public virtual async Task<Response<TagsResource>> CreateOrUpdateAtScopeAsync(string scope, TagsResource paramete
 193        {
 16194            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.CreateOrUpdateAtScope");
 16195            scope0.Start();
 196            try
 197            {
 16198                return await RestClient.CreateOrUpdateAtScopeAsync(scope, parameters, cancellationToken).ConfigureAwait(
 199            }
 0200            catch (Exception e)
 201            {
 0202                scope0.Failed(e);
 0203                throw;
 204            }
 16205        }
 206
 207        /// <summary> This operation allows adding or replacing the entire set of tags on the specified resource or subs
 208        /// <param name="scope"> The resource scope. </param>
 209        /// <param name="parameters"> The TagsResource to use. </param>
 210        /// <param name="cancellationToken"> The cancellation token to use. </param>
 211        public virtual Response<TagsResource> CreateOrUpdateAtScope(string scope, TagsResource parameters, CancellationT
 212        {
 16213            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.CreateOrUpdateAtScope");
 16214            scope0.Start();
 215            try
 216            {
 16217                return RestClient.CreateOrUpdateAtScope(scope, parameters, cancellationToken);
 218            }
 0219            catch (Exception e)
 220            {
 0221                scope0.Failed(e);
 0222                throw;
 223            }
 16224        }
 225
 226        /// <summary> This operation allows replacing, merging or selectively deleting tags on the specified resource or
 227        /// <param name="scope"> The resource scope. </param>
 228        /// <param name="parameters"> The TagsPatchResource to use. </param>
 229        /// <param name="cancellationToken"> The cancellation token to use. </param>
 230        public virtual async Task<Response<TagsResource>> UpdateAtScopeAsync(string scope, TagsPatchResource parameters,
 231        {
 12232            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.UpdateAtScope");
 12233            scope0.Start();
 234            try
 235            {
 12236                return await RestClient.UpdateAtScopeAsync(scope, parameters, cancellationToken).ConfigureAwait(false);
 237            }
 0238            catch (Exception e)
 239            {
 0240                scope0.Failed(e);
 0241                throw;
 242            }
 12243        }
 244
 245        /// <summary> This operation allows replacing, merging or selectively deleting tags on the specified resource or
 246        /// <param name="scope"> The resource scope. </param>
 247        /// <param name="parameters"> The TagsPatchResource to use. </param>
 248        /// <param name="cancellationToken"> The cancellation token to use. </param>
 249        public virtual Response<TagsResource> UpdateAtScope(string scope, TagsPatchResource parameters, CancellationToke
 250        {
 12251            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.UpdateAtScope");
 12252            scope0.Start();
 253            try
 254            {
 12255                return RestClient.UpdateAtScope(scope, parameters, cancellationToken);
 256            }
 0257            catch (Exception e)
 258            {
 0259                scope0.Failed(e);
 0260                throw;
 261            }
 12262        }
 263
 264        /// <summary> Gets the entire set of tags on a resource or subscription. </summary>
 265        /// <param name="scope"> The resource scope. </param>
 266        /// <param name="cancellationToken"> The cancellation token to use. </param>
 267        public virtual async Task<Response<TagsResource>> GetAtScopeAsync(string scope, CancellationToken cancellationTo
 268        {
 8269            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.GetAtScope");
 8270            scope0.Start();
 271            try
 272            {
 8273                return await RestClient.GetAtScopeAsync(scope, cancellationToken).ConfigureAwait(false);
 274            }
 0275            catch (Exception e)
 276            {
 0277                scope0.Failed(e);
 0278                throw;
 279            }
 8280        }
 281
 282        /// <summary> Gets the entire set of tags on a resource or subscription. </summary>
 283        /// <param name="scope"> The resource scope. </param>
 284        /// <param name="cancellationToken"> The cancellation token to use. </param>
 285        public virtual Response<TagsResource> GetAtScope(string scope, CancellationToken cancellationToken = default)
 286        {
 8287            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.GetAtScope");
 8288            scope0.Start();
 289            try
 290            {
 8291                return RestClient.GetAtScope(scope, cancellationToken);
 292            }
 0293            catch (Exception e)
 294            {
 0295                scope0.Failed(e);
 0296                throw;
 297            }
 8298        }
 299
 300        /// <summary> Deletes the entire set of tags on a resource or subscription. </summary>
 301        /// <param name="scope"> The resource scope. </param>
 302        /// <param name="cancellationToken"> The cancellation token to use. </param>
 303        public virtual async Task<Response> DeleteAtScopeAsync(string scope, CancellationToken cancellationToken = defau
 304        {
 4305            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.DeleteAtScope");
 4306            scope0.Start();
 307            try
 308            {
 4309                return await RestClient.DeleteAtScopeAsync(scope, cancellationToken).ConfigureAwait(false);
 310            }
 0311            catch (Exception e)
 312            {
 0313                scope0.Failed(e);
 0314                throw;
 315            }
 4316        }
 317
 318        /// <summary> Deletes the entire set of tags on a resource or subscription. </summary>
 319        /// <param name="scope"> The resource scope. </param>
 320        /// <param name="cancellationToken"> The cancellation token to use. </param>
 321        public virtual Response DeleteAtScope(string scope, CancellationToken cancellationToken = default)
 322        {
 4323            using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.DeleteAtScope");
 4324            scope0.Start();
 325            try
 326            {
 4327                return RestClient.DeleteAtScope(scope, cancellationToken);
 328            }
 0329            catch (Exception e)
 330            {
 0331                scope0.Failed(e);
 0332                throw;
 333            }
 4334        }
 335
 336        /// <summary> This operation performs a union of predefined tags, resource tags, resource group tags and subscri
 337        /// <param name="cancellationToken"> The cancellation token to use. </param>
 338        public virtual AsyncPageable<TagDetails> ListAsync(CancellationToken cancellationToken = default)
 339        {
 340            async Task<Page<TagDetails>> FirstPageFunc(int? pageSizeHint)
 341            {
 4342                using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.List");
 4343                scope0.Start();
 344                try
 345                {
 4346                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 4347                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 348                }
 0349                catch (Exception e)
 350                {
 0351                    scope0.Failed(e);
 0352                    throw;
 353                }
 4354            }
 355            async Task<Page<TagDetails>> NextPageFunc(string nextLink, int? pageSizeHint)
 356            {
 0357                using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.List");
 0358                scope0.Start();
 359                try
 360                {
 0361                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0362                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 363                }
 0364                catch (Exception e)
 365                {
 0366                    scope0.Failed(e);
 0367                    throw;
 368                }
 0369            }
 4370            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 371        }
 372
 373        /// <summary> This operation performs a union of predefined tags, resource tags, resource group tags and subscri
 374        /// <param name="cancellationToken"> The cancellation token to use. </param>
 375        public virtual Pageable<TagDetails> List(CancellationToken cancellationToken = default)
 376        {
 377            Page<TagDetails> FirstPageFunc(int? pageSizeHint)
 378            {
 4379                using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.List");
 4380                scope0.Start();
 381                try
 382                {
 4383                    var response = RestClient.List(cancellationToken);
 4384                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 385                }
 0386                catch (Exception e)
 387                {
 0388                    scope0.Failed(e);
 0389                    throw;
 390                }
 4391            }
 392            Page<TagDetails> NextPageFunc(string nextLink, int? pageSizeHint)
 393            {
 0394                using var scope0 = _clientDiagnostics.CreateScope("TagsOperations.List");
 0395                scope0.Start();
 396                try
 397                {
 0398                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0399                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 400                }
 0401                catch (Exception e)
 402                {
 0403                    scope0.Failed(e);
 0404                    throw;
 405                }
 0406            }
 4407            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 408        }
 409    }
 410}