< Summary

Class:Azure.ResourceManager.AppConfiguration.Operations
Assembly:Azure.ResourceManager.AppConfiguration
File(s):C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Operations.cs
Covered lines:28
Uncovered lines:28
Coverable lines:56
Total lines:153
Line coverage:50% (28 of 56)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
CheckNameAvailabilityAsync()-57.14%100%
CheckNameAvailability(...)-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\appconfiguration\Azure.ResourceManager.AppConfiguration\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.AppConfiguration.Models;
 15
 16namespace Azure.ResourceManager.AppConfiguration
 17{
 18    /// <summary> The  service client. </summary>
 19    public partial class Operations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 823        internal RestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of Operations for mocking. </summary>
 825        protected Operations()
 26        {
 827        }
 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="subscriptionId"> The Microsoft Azure subscription ID. </param>
 32        /// <param name="endpoint"> server parameter. </param>
 33        /// <param name="apiVersion"> Api Version. </param>
 834        internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpo
 35        {
 836            RestClient = new RestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion);
 837            _clientDiagnostics = clientDiagnostics;
 838            _pipeline = pipeline;
 839        }
 40
 41        /// <summary> Checks whether the configuration store name is available for use. </summary>
 42        /// <param name="checkNameAvailabilityParameters"> The object containing information for the availability reques
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<NameAvailabilityStatus>> CheckNameAvailabilityAsync(CheckNameAvailabilityPara
 45        {
 246            using var scope = _clientDiagnostics.CreateScope("Operations.CheckNameAvailability");
 247            scope.Start();
 48            try
 49            {
 250                return await RestClient.CheckNameAvailabilityAsync(checkNameAvailabilityParameters, cancellationToken).C
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 257        }
 58
 59        /// <summary> Checks whether the configuration store name is available for use. </summary>
 60        /// <param name="checkNameAvailabilityParameters"> The object containing information for the availability reques
 61        /// <param name="cancellationToken"> The cancellation token to use. </param>
 62        public virtual Response<NameAvailabilityStatus> CheckNameAvailability(CheckNameAvailabilityParameters checkNameA
 63        {
 264            using var scope = _clientDiagnostics.CreateScope("Operations.CheckNameAvailability");
 265            scope.Start();
 66            try
 67            {
 268                return RestClient.CheckNameAvailability(checkNameAvailabilityParameters, cancellationToken);
 69            }
 070            catch (Exception e)
 71            {
 072                scope.Failed(e);
 073                throw;
 74            }
 275        }
 76
 77        /// <summary> Lists the operations available from this provider. </summary>
 78        /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part
 79        /// <param name="cancellationToken"> The cancellation token to use. </param>
 80        public virtual AsyncPageable<OperationDefinition> ListAsync(string skipToken = null, CancellationToken cancellat
 81        {
 82            async Task<Page<OperationDefinition>> FirstPageFunc(int? pageSizeHint)
 83            {
 284                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 285                scope.Start();
 86                try
 87                {
 288                    var response = await RestClient.ListAsync(skipToken, cancellationToken).ConfigureAwait(false);
 289                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 90                }
 091                catch (Exception e)
 92                {
 093                    scope.Failed(e);
 094                    throw;
 95                }
 296            }
 97            async Task<Page<OperationDefinition>> NextPageFunc(string nextLink, int? pageSizeHint)
 98            {
 099                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 0100                scope.Start();
 101                try
 102                {
 0103                    var response = await RestClient.ListNextPageAsync(nextLink, skipToken, cancellationToken).ConfigureA
 0104                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 105                }
 0106                catch (Exception e)
 107                {
 0108                    scope.Failed(e);
 0109                    throw;
 110                }
 0111            }
 2112            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 113        }
 114
 115        /// <summary> Lists the operations available from this provider. </summary>
 116        /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part
 117        /// <param name="cancellationToken"> The cancellation token to use. </param>
 118        public virtual Pageable<OperationDefinition> List(string skipToken = null, CancellationToken cancellationToken =
 119        {
 120            Page<OperationDefinition> FirstPageFunc(int? pageSizeHint)
 121            {
 2122                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 2123                scope.Start();
 124                try
 125                {
 2126                    var response = RestClient.List(skipToken, cancellationToken);
 2127                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 128                }
 0129                catch (Exception e)
 130                {
 0131                    scope.Failed(e);
 0132                    throw;
 133                }
 2134            }
 135            Page<OperationDefinition> NextPageFunc(string nextLink, int? pageSizeHint)
 136            {
 0137                using var scope = _clientDiagnostics.CreateScope("Operations.List");
 0138                scope.Start();
 139                try
 140                {
 0141                    var response = RestClient.ListNextPage(nextLink, skipToken, cancellationToken);
 0142                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 143                }
 0144                catch (Exception e)
 145                {
 0146                    scope.Failed(e);
 0147                    throw;
 148                }
 0149            }
 2150            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 151        }
 152    }
 153}