< Summary

Class:Azure.ResourceManager.Storage.EncryptionScopesOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\EncryptionScopesOperations.cs
Covered lines:48
Uncovered lines:44
Coverable lines:92
Total lines:261
Line coverage:52.1% (48 of 92)
Covered branches:4
Total branches:8
Branch coverage:50% (4 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
PutAsync()-57.14%100%
Put(...)-57.14%100%
PatchAsync()-57.14%100%
Patch(...)-57.14%100%
GetAsync()-57.14%100%
Get(...)-57.14%100%
ListAsync(...)-38.1%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
List(...)-38.1%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\EncryptionScopesOperations.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.Storage.Models;
 15
 16namespace Azure.ResourceManager.Storage
 17{
 18    /// <summary> The EncryptionScopes service client. </summary>
 19    public partial class EncryptionScopesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 2423        internal EncryptionScopesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of EncryptionScopesOperations for mocking. </summary>
 24025        protected EncryptionScopesOperations()
 26        {
 24027        }
 28        /// <summary> Initializes a new instance of EncryptionScopesOperations. </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>
 33        /// <param name="apiVersion"> Api Version. </param>
 24034        internal EncryptionScopesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript
 35        {
 24036            RestClient = new EncryptionScopesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVe
 24037            _clientDiagnostics = clientDiagnostics;
 24038            _pipeline = pipeline;
 24039        }
 40
 41        /// <summary> Synchronously creates or updates an encryption scope under the specified storage account. If an en
 42        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 43        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 44        /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En
 45        /// <param name="encryptionScope"> Encryption scope properties to be used for the create or update. </param>
 46        /// <param name="cancellationToken"> The cancellation token to use. </param>
 47        public virtual async Task<Response<EncryptionScope>> PutAsync(string resourceGroupName, string accountName, stri
 48        {
 649            using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Put");
 650            scope.Start();
 51            try
 52            {
 653                return await RestClient.PutAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope, c
 54            }
 055            catch (Exception e)
 56            {
 057                scope.Failed(e);
 058                throw;
 59            }
 660        }
 61
 62        /// <summary> Synchronously creates or updates an encryption scope under the specified storage account. If an en
 63        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 64        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 65        /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En
 66        /// <param name="encryptionScope"> Encryption scope properties to be used for the create or update. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public virtual Response<EncryptionScope> Put(string resourceGroupName, string accountName, string encryptionScop
 69        {
 670            using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Put");
 671            scope.Start();
 72            try
 73            {
 674                return RestClient.Put(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellation
 75            }
 076            catch (Exception e)
 77            {
 078                scope.Failed(e);
 079                throw;
 80            }
 681        }
 82
 83        /// <summary> Update encryption scope properties as specified in the request body. Update fails if the specified
 84        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 85        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 86        /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En
 87        /// <param name="encryptionScope"> Encryption scope properties to be used for the update. </param>
 88        /// <param name="cancellationToken"> The cancellation token to use. </param>
 89        public virtual async Task<Response<EncryptionScope>> PatchAsync(string resourceGroupName, string accountName, st
 90        {
 291            using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Patch");
 292            scope.Start();
 93            try
 94            {
 295                return await RestClient.PatchAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope,
 96            }
 097            catch (Exception e)
 98            {
 099                scope.Failed(e);
 0100                throw;
 101            }
 2102        }
 103
 104        /// <summary> Update encryption scope properties as specified in the request body. Update fails if the specified
 105        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 106        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 107        /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En
 108        /// <param name="encryptionScope"> Encryption scope properties to be used for the update. </param>
 109        /// <param name="cancellationToken"> The cancellation token to use. </param>
 110        public virtual Response<EncryptionScope> Patch(string resourceGroupName, string accountName, string encryptionSc
 111        {
 2112            using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Patch");
 2113            scope.Start();
 114            try
 115            {
 2116                return RestClient.Patch(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellati
 117            }
 0118            catch (Exception e)
 119            {
 0120                scope.Failed(e);
 0121                throw;
 122            }
 2123        }
 124
 125        /// <summary> Returns the properties for the specified encryption scope. </summary>
 126        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 127        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 128        /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En
 129        /// <param name="cancellationToken"> The cancellation token to use. </param>
 130        public virtual async Task<Response<EncryptionScope>> GetAsync(string resourceGroupName, string accountName, stri
 131        {
 2132            using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Get");
 2133            scope.Start();
 134            try
 135            {
 2136                return await RestClient.GetAsync(resourceGroupName, accountName, encryptionScopeName, cancellationToken)
 137            }
 0138            catch (Exception e)
 139            {
 0140                scope.Failed(e);
 0141                throw;
 142            }
 2143        }
 144
 145        /// <summary> Returns the properties for the specified encryption scope. </summary>
 146        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 147        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 148        /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En
 149        /// <param name="cancellationToken"> The cancellation token to use. </param>
 150        public virtual Response<EncryptionScope> Get(string resourceGroupName, string accountName, string encryptionScop
 151        {
 2152            using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Get");
 2153            scope.Start();
 154            try
 155            {
 2156                return RestClient.Get(resourceGroupName, accountName, encryptionScopeName, cancellationToken);
 157            }
 0158            catch (Exception e)
 159            {
 0160                scope.Failed(e);
 0161                throw;
 162            }
 2163        }
 164
 165        /// <summary> Lists all the encryption scopes available under the specified storage account. </summary>
 166        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 167        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 168        /// <param name="cancellationToken"> The cancellation token to use. </param>
 169        public virtual AsyncPageable<EncryptionScope> ListAsync(string resourceGroupName, string accountName, Cancellati
 170        {
 2171            if (resourceGroupName == null)
 172            {
 0173                throw new ArgumentNullException(nameof(resourceGroupName));
 174            }
 2175            if (accountName == null)
 176            {
 0177                throw new ArgumentNullException(nameof(accountName));
 178            }
 179
 180            async Task<Page<EncryptionScope>> FirstPageFunc(int? pageSizeHint)
 181            {
 2182                using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.List");
 2183                scope.Start();
 184                try
 185                {
 2186                    var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).Configu
 2187                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 188                }
 0189                catch (Exception e)
 190                {
 0191                    scope.Failed(e);
 0192                    throw;
 193                }
 2194            }
 195            async Task<Page<EncryptionScope>> NextPageFunc(string nextLink, int? pageSizeHint)
 196            {
 0197                using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.List");
 0198                scope.Start();
 199                try
 200                {
 0201                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, cancella
 0202                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 203                }
 0204                catch (Exception e)
 205                {
 0206                    scope.Failed(e);
 0207                    throw;
 208                }
 0209            }
 2210            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 211        }
 212
 213        /// <summary> Lists all the encryption scopes available under the specified storage account. </summary>
 214        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 215        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 216        /// <param name="cancellationToken"> The cancellation token to use. </param>
 217        public virtual Pageable<EncryptionScope> List(string resourceGroupName, string accountName, CancellationToken ca
 218        {
 2219            if (resourceGroupName == null)
 220            {
 0221                throw new ArgumentNullException(nameof(resourceGroupName));
 222            }
 2223            if (accountName == null)
 224            {
 0225                throw new ArgumentNullException(nameof(accountName));
 226            }
 227
 228            Page<EncryptionScope> FirstPageFunc(int? pageSizeHint)
 229            {
 2230                using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.List");
 2231                scope.Start();
 232                try
 233                {
 2234                    var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
 2235                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 236                }
 0237                catch (Exception e)
 238                {
 0239                    scope.Failed(e);
 0240                    throw;
 241                }
 2242            }
 243            Page<EncryptionScope> NextPageFunc(string nextLink, int? pageSizeHint)
 244            {
 0245                using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.List");
 0246                scope.Start();
 247                try
 248                {
 0249                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, cancellationToken);
 0250                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 251                }
 0252                catch (Exception e)
 253                {
 0254                    scope.Failed(e);
 0255                    throw;
 256                }
 0257            }
 2258            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 259        }
 260    }
 261}