< Summary

Class:Azure.ResourceManager.Resources.ProvidersOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ProvidersOperations.cs
Covered lines:62
Uncovered lines:70
Coverable lines:132
Total lines:344
Line coverage:46.9% (62 of 132)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
UnregisterAsync()-100%100%
Unregister(...)-100%100%
RegisterAsync()-100%100%
Register(...)-100%100%
GetAsync()-100%100%
Get(...)-100%100%
GetAtTenantScopeAsync()-0%100%
GetAtTenantScope(...)-0%100%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
ListAsync(...)-100%100%
List(...)-100%100%
<ListAtTenantScopeAsync()-0%100%
<ListAtTenantScopeAsync()-0%100%
ListAtTenantScopeAsync(...)-0%100%
ListAtTenantScope(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ProvidersOperations.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 Providers service client. </summary>
 19    public partial class ProvidersOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 8023        internal ProvidersRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ProvidersOperations for mocking. </summary>
 28425        protected ProvidersOperations()
 26        {
 28427        }
 28        /// <summary> Initializes a new instance of ProvidersOperations. </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>
 28433        internal ProvidersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, 
 34        {
 28435            RestClient = new ProvidersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 28436            _clientDiagnostics = clientDiagnostics;
 28437            _pipeline = pipeline;
 28438        }
 39
 40        /// <summary> Unregisters a subscription from a resource provider. </summary>
 41        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param>
 42        /// <param name="cancellationToken"> The cancellation token to use. </param>
 43        public virtual async Task<Response<Provider>> UnregisterAsync(string resourceProviderNamespace, CancellationToke
 44        {
 645            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Unregister");
 646            scope.Start();
 47            try
 48            {
 649                return await RestClient.UnregisterAsync(resourceProviderNamespace, cancellationToken).ConfigureAwait(fal
 50            }
 251            catch (Exception e)
 52            {
 253                scope.Failed(e);
 254                throw;
 55            }
 456        }
 57
 58        /// <summary> Unregisters a subscription from a resource provider. </summary>
 59        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param>
 60        /// <param name="cancellationToken"> The cancellation token to use. </param>
 61        public virtual Response<Provider> Unregister(string resourceProviderNamespace, CancellationToken cancellationTok
 62        {
 663            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Unregister");
 664            scope.Start();
 65            try
 66            {
 667                return RestClient.Unregister(resourceProviderNamespace, cancellationToken);
 68            }
 269            catch (Exception e)
 70            {
 271                scope.Failed(e);
 272                throw;
 73            }
 474        }
 75
 76        /// <summary> Registers a subscription with a resource provider. </summary>
 77        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param>
 78        /// <param name="cancellationToken"> The cancellation token to use. </param>
 79        public virtual async Task<Response<Provider>> RegisterAsync(string resourceProviderNamespace, CancellationToken 
 80        {
 1481            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Register");
 1482            scope.Start();
 83            try
 84            {
 1485                return await RestClient.RegisterAsync(resourceProviderNamespace, cancellationToken).ConfigureAwait(false
 86            }
 287            catch (Exception e)
 88            {
 289                scope.Failed(e);
 290                throw;
 91            }
 1292        }
 93
 94        /// <summary> Registers a subscription with a resource provider. </summary>
 95        /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param>
 96        /// <param name="cancellationToken"> The cancellation token to use. </param>
 97        public virtual Response<Provider> Register(string resourceProviderNamespace, CancellationToken cancellationToken
 98        {
 1499            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Register");
 14100            scope.Start();
 101            try
 102            {
 14103                return RestClient.Register(resourceProviderNamespace, cancellationToken);
 104            }
 2105            catch (Exception e)
 106            {
 2107                scope.Failed(e);
 2108                throw;
 109            }
 12110        }
 111
 112        /// <summary> Gets the specified resource provider. </summary>
 113        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 114        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 115        /// <param name="cancellationToken"> The cancellation token to use. </param>
 116        public virtual async Task<Response<Provider>> GetAsync(string resourceProviderNamespace, string expand = null, C
 117        {
 14118            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Get");
 14119            scope.Start();
 120            try
 121            {
 14122                return await RestClient.GetAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(fa
 123            }
 2124            catch (Exception e)
 125            {
 2126                scope.Failed(e);
 2127                throw;
 128            }
 12129        }
 130
 131        /// <summary> Gets the specified resource provider. </summary>
 132        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 133        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 134        /// <param name="cancellationToken"> The cancellation token to use. </param>
 135        public virtual Response<Provider> Get(string resourceProviderNamespace, string expand = null, CancellationToken 
 136        {
 14137            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Get");
 14138            scope.Start();
 139            try
 140            {
 14141                return RestClient.Get(resourceProviderNamespace, expand, cancellationToken);
 142            }
 2143            catch (Exception e)
 144            {
 2145                scope.Failed(e);
 2146                throw;
 147            }
 12148        }
 149
 150        /// <summary> Gets the specified resource provider at the tenant level. </summary>
 151        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 152        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 153        /// <param name="cancellationToken"> The cancellation token to use. </param>
 154        public virtual async Task<Response<Provider>> GetAtTenantScopeAsync(string resourceProviderNamespace, string exp
 155        {
 0156            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.GetAtTenantScope");
 0157            scope.Start();
 158            try
 159            {
 0160                return await RestClient.GetAtTenantScopeAsync(resourceProviderNamespace, expand, cancellationToken).Conf
 161            }
 0162            catch (Exception e)
 163            {
 0164                scope.Failed(e);
 0165                throw;
 166            }
 0167        }
 168
 169        /// <summary> Gets the specified resource provider at the tenant level. </summary>
 170        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 171        /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use
 172        /// <param name="cancellationToken"> The cancellation token to use. </param>
 173        public virtual Response<Provider> GetAtTenantScope(string resourceProviderNamespace, string expand = null, Cance
 174        {
 0175            using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.GetAtTenantScope");
 0176            scope.Start();
 177            try
 178            {
 0179                return RestClient.GetAtTenantScope(resourceProviderNamespace, expand, cancellationToken);
 180            }
 0181            catch (Exception e)
 182            {
 0183                scope.Failed(e);
 0184                throw;
 185            }
 0186        }
 187
 188        /// <summary> Gets all resource providers for a subscription. </summary>
 189        /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param>
 190        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 191        /// <param name="cancellationToken"> The cancellation token to use. </param>
 192        public virtual AsyncPageable<Provider> ListAsync(int? top = null, string expand = null, CancellationToken cancel
 193        {
 194            async Task<Page<Provider>> FirstPageFunc(int? pageSizeHint)
 195            {
 6196                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List");
 6197                scope.Start();
 198                try
 199                {
 6200                    var response = await RestClient.ListAsync(top, expand, cancellationToken).ConfigureAwait(false);
 6201                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 202                }
 0203                catch (Exception e)
 204                {
 0205                    scope.Failed(e);
 0206                    throw;
 207                }
 6208            }
 209            async Task<Page<Provider>> NextPageFunc(string nextLink, int? pageSizeHint)
 210            {
 0211                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List");
 0212                scope.Start();
 213                try
 214                {
 0215                    var response = await RestClient.ListNextPageAsync(nextLink, top, expand, cancellationToken).Configur
 0216                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 217                }
 0218                catch (Exception e)
 219                {
 0220                    scope.Failed(e);
 0221                    throw;
 222                }
 0223            }
 6224            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 225        }
 226
 227        /// <summary> Gets all resource providers for a subscription. </summary>
 228        /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param>
 229        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 230        /// <param name="cancellationToken"> The cancellation token to use. </param>
 231        public virtual Pageable<Provider> List(int? top = null, string expand = null, CancellationToken cancellationToke
 232        {
 233            Page<Provider> FirstPageFunc(int? pageSizeHint)
 234            {
 6235                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List");
 6236                scope.Start();
 237                try
 238                {
 6239                    var response = RestClient.List(top, expand, cancellationToken);
 6240                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 241                }
 0242                catch (Exception e)
 243                {
 0244                    scope.Failed(e);
 0245                    throw;
 246                }
 6247            }
 248            Page<Provider> NextPageFunc(string nextLink, int? pageSizeHint)
 249            {
 0250                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List");
 0251                scope.Start();
 252                try
 253                {
 0254                    var response = RestClient.ListNextPage(nextLink, top, expand, cancellationToken);
 0255                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 256                }
 0257                catch (Exception e)
 258                {
 0259                    scope.Failed(e);
 0260                    throw;
 261                }
 0262            }
 6263            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 264        }
 265
 266        /// <summary> Gets all resource providers for the tenant. </summary>
 267        /// <param name="top"> The number of results to return. If null is passed returns all providers. </param>
 268        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 269        /// <param name="cancellationToken"> The cancellation token to use. </param>
 270        public virtual AsyncPageable<Provider> ListAtTenantScopeAsync(int? top = null, string expand = null, Cancellatio
 271        {
 272            async Task<Page<Provider>> FirstPageFunc(int? pageSizeHint)
 273            {
 0274                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope");
 0275                scope.Start();
 276                try
 277                {
 0278                    var response = await RestClient.ListAtTenantScopeAsync(top, expand, cancellationToken).ConfigureAwai
 0279                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 280                }
 0281                catch (Exception e)
 282                {
 0283                    scope.Failed(e);
 0284                    throw;
 285                }
 0286            }
 287            async Task<Page<Provider>> NextPageFunc(string nextLink, int? pageSizeHint)
 288            {
 0289                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope");
 0290                scope.Start();
 291                try
 292                {
 0293                    var response = await RestClient.ListAtTenantScopeNextPageAsync(nextLink, top, expand, cancellationTo
 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            }
 0302            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 303        }
 304
 305        /// <summary> Gets all resource providers for the tenant. </summary>
 306        /// <param name="top"> The number of results to return. If null is passed returns all providers. </param>
 307        /// <param name="expand"> The properties to include in the results. For example, use &amp;$expand=metadata in th
 308        /// <param name="cancellationToken"> The cancellation token to use. </param>
 309        public virtual Pageable<Provider> ListAtTenantScope(int? top = null, string expand = null, CancellationToken can
 310        {
 311            Page<Provider> FirstPageFunc(int? pageSizeHint)
 312            {
 0313                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope");
 0314                scope.Start();
 315                try
 316                {
 0317                    var response = RestClient.ListAtTenantScope(top, expand, cancellationToken);
 0318                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 319                }
 0320                catch (Exception e)
 321                {
 0322                    scope.Failed(e);
 0323                    throw;
 324                }
 0325            }
 326            Page<Provider> NextPageFunc(string nextLink, int? pageSizeHint)
 327            {
 0328                using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope");
 0329                scope.Start();
 330                try
 331                {
 0332                    var response = RestClient.ListAtTenantScopeNextPage(nextLink, top, expand, cancellationToken);
 0333                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 334                }
 0335                catch (Exception e)
 336                {
 0337                    scope.Failed(e);
 0338                    throw;
 339                }
 0340            }
 0341            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 342        }
 343    }
 344}