< Summary

Class:Azure.ResourceManager.Storage.ManagementPoliciesOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\ManagementPoliciesOperations.cs
Covered lines:38
Uncovered lines:12
Coverable lines:50
Total lines:156
Line coverage:76% (38 of 50)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetAsync()-100%100%
Get(...)-100%100%
CreateOrUpdateAsync()-57.14%100%
CreateOrUpdate(...)-57.14%100%
DeleteAsync()-57.14%100%
Delete(...)-57.14%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\ManagementPoliciesOperations.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.Pipeline;
 13using Azure.ResourceManager.Storage.Models;
 14
 15namespace Azure.ResourceManager.Storage
 16{
 17    /// <summary> The ManagementPolicies service client. </summary>
 18    public partial class ManagementPoliciesOperations
 19    {
 20        private readonly ClientDiagnostics _clientDiagnostics;
 21        private readonly HttpPipeline _pipeline;
 2022        internal ManagementPoliciesRestOperations RestClient { get; }
 23        /// <summary> Initializes a new instance of ManagementPoliciesOperations for mocking. </summary>
 24024        protected ManagementPoliciesOperations()
 25        {
 24026        }
 27        /// <summary> Initializes a new instance of ManagementPoliciesOperations. </summary>
 28        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 29        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 30        /// <param name="subscriptionId"> The ID of the target subscription. </param>
 31        /// <param name="endpoint"> server parameter. </param>
 32        /// <param name="apiVersion"> Api Version. </param>
 24033        internal ManagementPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscri
 34        {
 24035            RestClient = new ManagementPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, api
 24036            _clientDiagnostics = clientDiagnostics;
 24037            _pipeline = pipeline;
 24038        }
 39
 40        /// <summary> Gets the managementpolicy associated with the specified storage account. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 42        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<ManagementPolicy>> GetAsync(string resourceGroupName, string accountName, Can
 45        {
 446            using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesOperations.Get");
 447            scope.Start();
 48            try
 49            {
 450                return await RestClient.GetAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false
 51            }
 252            catch (Exception e)
 53            {
 254                scope.Failed(e);
 255                throw;
 56            }
 257        }
 58
 59        /// <summary> Gets the managementpolicy associated with the specified storage account. </summary>
 60        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 61        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<ManagementPolicy> Get(string resourceGroupName, string accountName, CancellationToken ca
 64        {
 465            using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesOperations.Get");
 466            scope.Start();
 67            try
 68            {
 469                return RestClient.Get(resourceGroupName, accountName, cancellationToken);
 70            }
 271            catch (Exception e)
 72            {
 273                scope.Failed(e);
 274                throw;
 75            }
 276        }
 77
 78        /// <summary> Sets the managementpolicy to the specified storage account. </summary>
 79        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 80        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 81        /// <param name="properties"> The ManagementPolicy set to a storage account. </param>
 82        /// <param name="cancellationToken"> The cancellation token to use. </param>
 83        public virtual async Task<Response<ManagementPolicy>> CreateOrUpdateAsync(string resourceGroupName, string accou
 84        {
 285            using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesOperations.CreateOrUpdate");
 286            scope.Start();
 87            try
 88            {
 289                return await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, properties, cancellationToke
 90            }
 091            catch (Exception e)
 92            {
 093                scope.Failed(e);
 094                throw;
 95            }
 296        }
 97
 98        /// <summary> Sets the managementpolicy to the specified storage account. </summary>
 99        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 100        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 101        /// <param name="properties"> The ManagementPolicy set to a storage account. </param>
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<ManagementPolicy> CreateOrUpdate(string resourceGroupName, string accountName, Managemen
 104        {
 2105            using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesOperations.CreateOrUpdate");
 2106            scope.Start();
 107            try
 108            {
 2109                return RestClient.CreateOrUpdate(resourceGroupName, accountName, properties, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 2116        }
 117
 118        /// <summary> Deletes the managementpolicy associated with the specified storage account. </summary>
 119        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 120        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, CancellationToken 
 123        {
 4124            using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesOperations.Delete");
 4125            scope.Start();
 126            try
 127            {
 4128                return await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(fa
 129            }
 0130            catch (Exception e)
 131            {
 0132                scope.Failed(e);
 0133                throw;
 134            }
 4135        }
 136
 137        /// <summary> Deletes the managementpolicy associated with the specified storage account. </summary>
 138        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 139        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 140        /// <param name="cancellationToken"> The cancellation token to use. </param>
 141        public virtual Response Delete(string resourceGroupName, string accountName, CancellationToken cancellationToken
 142        {
 4143            using var scope = _clientDiagnostics.CreateScope("ManagementPoliciesOperations.Delete");
 4144            scope.Start();
 145            try
 146            {
 4147                return RestClient.Delete(resourceGroupName, accountName, cancellationToken);
 148            }
 0149            catch (Exception e)
 150            {
 0151                scope.Failed(e);
 0152                throw;
 153            }
 4154        }
 155    }
 156}