< Summary

Class:Azure.ResourceManager.KeyVault.Operations
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Operations.cs
Covered lines:0
Uncovered lines:42
Coverable lines:42
Total lines:114
Line coverage:0% (0 of 42)
Covered branches:0
Total branches:0

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Operations.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.KeyVault.Models;
 15
 16namespace Azure.ResourceManager.KeyVault
 17{
 18    /// <summary> The  service client. </summary>
 19    public partial class Operations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal RestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of Operations for mocking. </summary>
 025        protected Operations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of Operations. </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="endpoint"> server parameter. </param>
 32        /// <param name="apiVersion"> Api Version. </param>
 033        internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null, string apiV
 34        {
 035            RestClient = new RestOperations(clientDiagnostics, pipeline, endpoint, apiVersion);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Lists all of the available Key Vault Rest API operations. </summary>
 41        /// <param name="cancellationToken"> The cancellation token to use. </param>
 42        public virtual AsyncPageable<Operation> ListAsync(CancellationToken cancellationToken = default)
 43        {
 44            async Task<Page<Operation>> FirstPageFunc(int? pageSizeHint)
 45            {
 046                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 047                scope.Start();
 48                try
 49                {
 050                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 051                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 52                }
 053                catch (Exception e)
 54                {
 055                    scope.Failed(e);
 056                    throw;
 57                }
 058            }
 59            async Task<Page<Operation>> NextPageFunc(string nextLink, int? pageSizeHint)
 60            {
 061                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 062                scope.Start();
 63                try
 64                {
 065                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 066                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 67                }
 068                catch (Exception e)
 69                {
 070                    scope.Failed(e);
 071                    throw;
 72                }
 073            }
 074            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 75        }
 76
 77        /// <summary> Lists all of the available Key Vault Rest API operations. </summary>
 78        /// <param name="cancellationToken"> The cancellation token to use. </param>
 79        public virtual Pageable<Operation> List(CancellationToken cancellationToken = default)
 80        {
 81            Page<Operation> FirstPageFunc(int? pageSizeHint)
 82            {
 083                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 084                scope.Start();
 85                try
 86                {
 087                    var response = RestClient.List(cancellationToken);
 088                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 89                }
 090                catch (Exception e)
 91                {
 092                    scope.Failed(e);
 093                    throw;
 94                }
 095            }
 96            Page<Operation> NextPageFunc(string nextLink, int? pageSizeHint)
 97            {
 098                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 099                scope.Start();
 100                try
 101                {
 0102                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0103                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 104                }
 0105                catch (Exception e)
 106                {
 0107                    scope.Failed(e);
 0108                    throw;
 109                }
 0110            }
 0111            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 112        }
 113    }
 114}