< Summary

Class:Azure.ResourceManager.Compute.ResourceSkusOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ResourceSkusOperations.cs
Covered lines:20
Uncovered lines:22
Coverable lines:42
Total lines:116
Line coverage:47.6% (20 of 42)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
ListAsync(...)-100%100%
List(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ResourceSkusOperations.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.Compute.Models;
 15
 16namespace Azure.ResourceManager.Compute
 17{
 18    /// <summary> The ResourceSkus service client. </summary>
 19    public partial class ResourceSkusOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 423        internal ResourceSkusRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ResourceSkusOperations for mocking. </summary>
 39625        protected ResourceSkusOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of ResourceSkusOperations. </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"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 32        /// <param name="endpoint"> server parameter. </param>
 39633        internal ResourceSkusOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionI
 34        {
 39635            RestClient = new ResourceSkusRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Gets the list of Microsoft.Compute SKUs available for your Subscription. </summary>
 41        /// <param name="filter"> The filter to apply on the operation. Only **location** filter is supported currently.
 42        /// <param name="cancellationToken"> The cancellation token to use. </param>
 43        public virtual AsyncPageable<ResourceSku> ListAsync(string filter = null, CancellationToken cancellationToken = 
 44        {
 45            async Task<Page<ResourceSku>> FirstPageFunc(int? pageSizeHint)
 46            {
 247                using var scope = _clientDiagnostics.CreateScope("ResourceSkusOperations.List");
 248                scope.Start();
 49                try
 50                {
 251                    var response = await RestClient.ListAsync(filter, cancellationToken).ConfigureAwait(false);
 252                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 53                }
 054                catch (Exception e)
 55                {
 056                    scope.Failed(e);
 057                    throw;
 58                }
 259            }
 60            async Task<Page<ResourceSku>> NextPageFunc(string nextLink, int? pageSizeHint)
 61            {
 062                using var scope = _clientDiagnostics.CreateScope("ResourceSkusOperations.List");
 063                scope.Start();
 64                try
 65                {
 066                    var response = await RestClient.ListNextPageAsync(nextLink, filter, cancellationToken).ConfigureAwai
 067                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 68                }
 069                catch (Exception e)
 70                {
 071                    scope.Failed(e);
 072                    throw;
 73                }
 074            }
 275            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 76        }
 77
 78        /// <summary> Gets the list of Microsoft.Compute SKUs available for your Subscription. </summary>
 79        /// <param name="filter"> The filter to apply on the operation. Only **location** filter is supported currently.
 80        /// <param name="cancellationToken"> The cancellation token to use. </param>
 81        public virtual Pageable<ResourceSku> List(string filter = null, CancellationToken cancellationToken = default)
 82        {
 83            Page<ResourceSku> FirstPageFunc(int? pageSizeHint)
 84            {
 285                using var scope = _clientDiagnostics.CreateScope("ResourceSkusOperations.List");
 286                scope.Start();
 87                try
 88                {
 289                    var response = RestClient.List(filter, cancellationToken);
 290                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 91                }
 092                catch (Exception e)
 93                {
 094                    scope.Failed(e);
 095                    throw;
 96                }
 297            }
 98            Page<ResourceSku> NextPageFunc(string nextLink, int? pageSizeHint)
 99            {
 0100                using var scope = _clientDiagnostics.CreateScope("ResourceSkusOperations.List");
 0101                scope.Start();
 102                try
 103                {
 0104                    var response = RestClient.ListNextPage(nextLink, filter, cancellationToken);
 0105                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 106                }
 0107                catch (Exception e)
 108                {
 0109                    scope.Failed(e);
 0110                    throw;
 111                }
 0112            }
 2113            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 114        }
 115    }
 116}