< Summary

Class:Azure.ResourceManager.Storage.ObjectReplicationPoliciesOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\ObjectReplicationPoliciesOperations.cs
Covered lines:48
Uncovered lines:28
Coverable lines:76
Total lines:229
Line coverage:63.1% (48 of 76)
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%
GetAsync()-57.14%100%
Get(...)-57.14%100%
CreateOrUpdateAsync()-57.14%100%
CreateOrUpdate(...)-57.14%100%
DeleteAsync()-57.14%100%
Delete(...)-57.14%100%
ListAsync(...)-61.54%50%
<ListAsync()-62.5%100%
List(...)-61.54%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\ObjectReplicationPoliciesOperations.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 ObjectReplicationPolicies service client. </summary>
 19    public partial class ObjectReplicationPoliciesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 3223        internal ObjectReplicationPoliciesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ObjectReplicationPoliciesOperations for mocking. </summary>
 24025        protected ObjectReplicationPoliciesOperations()
 26        {
 24027        }
 28        /// <summary> Initializes a new instance of ObjectReplicationPoliciesOperations. </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 ObjectReplicationPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string 
 35        {
 24036            RestClient = new ObjectReplicationPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoi
 24037            _clientDiagnostics = clientDiagnostics;
 24038            _pipeline = pipeline;
 24039        }
 40
 41        /// <summary> Get the object replication policy of the storage account by policy ID. </summary>
 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="objectReplicationPolicyId"> The ID of object replication policy or &apos;default&apos; if the p
 45        /// <param name="cancellationToken"> The cancellation token to use. </param>
 46        public virtual async Task<Response<ObjectReplicationPolicy>> GetAsync(string resourceGroupName, string accountNa
 47        {
 448            using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.Get");
 449            scope.Start();
 50            try
 51            {
 452                return await RestClient.GetAsync(resourceGroupName, accountName, objectReplicationPolicyId, cancellation
 53            }
 054            catch (Exception e)
 55            {
 056                scope.Failed(e);
 057                throw;
 58            }
 459        }
 60
 61        /// <summary> Get the object replication policy of the storage account by policy ID. </summary>
 62        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 63        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 64        /// <param name="objectReplicationPolicyId"> The ID of object replication policy or &apos;default&apos; if the p
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public virtual Response<ObjectReplicationPolicy> Get(string resourceGroupName, string accountName, string object
 67        {
 468            using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.Get");
 469            scope.Start();
 70            try
 71            {
 472                return RestClient.Get(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken);
 73            }
 074            catch (Exception e)
 75            {
 076                scope.Failed(e);
 077                throw;
 78            }
 479        }
 80
 81        /// <summary> Create or update the object replication policy of the storage account. </summary>
 82        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 83        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 84        /// <param name="objectReplicationPolicyId"> The ID of object replication policy or &apos;default&apos; if the p
 85        /// <param name="properties"> The object replication policy set to a storage account. A unique policy ID will be
 86        /// <param name="cancellationToken"> The cancellation token to use. </param>
 87        public virtual async Task<Response<ObjectReplicationPolicy>> CreateOrUpdateAsync(string resourceGroupName, strin
 88        {
 489            using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.CreateOrUpdate");
 490            scope.Start();
 91            try
 92            {
 493                return await RestClient.CreateOrUpdateAsync(resourceGroupName, accountName, objectReplicationPolicyId, p
 94            }
 095            catch (Exception e)
 96            {
 097                scope.Failed(e);
 098                throw;
 99            }
 4100        }
 101
 102        /// <summary> Create or update the object replication policy of the storage account. </summary>
 103        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 104        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 105        /// <param name="objectReplicationPolicyId"> The ID of object replication policy or &apos;default&apos; if the p
 106        /// <param name="properties"> The object replication policy set to a storage account. A unique policy ID will be
 107        /// <param name="cancellationToken"> The cancellation token to use. </param>
 108        public virtual Response<ObjectReplicationPolicy> CreateOrUpdate(string resourceGroupName, string accountName, st
 109        {
 4110            using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.CreateOrUpdate");
 4111            scope.Start();
 112            try
 113            {
 4114                return RestClient.CreateOrUpdate(resourceGroupName, accountName, objectReplicationPolicyId, properties, 
 115            }
 0116            catch (Exception e)
 117            {
 0118                scope.Failed(e);
 0119                throw;
 120            }
 4121        }
 122
 123        /// <summary> Deletes the object replication policy associated with the specified storage account. </summary>
 124        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 125        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 126        /// <param name="objectReplicationPolicyId"> The ID of object replication policy or &apos;default&apos; if the p
 127        /// <param name="cancellationToken"> The cancellation token to use. </param>
 128        public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string objectRepli
 129        {
 4130            using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.Delete");
 4131            scope.Start();
 132            try
 133            {
 4134                return await RestClient.DeleteAsync(resourceGroupName, accountName, objectReplicationPolicyId, cancellat
 135            }
 0136            catch (Exception e)
 137            {
 0138                scope.Failed(e);
 0139                throw;
 140            }
 4141        }
 142
 143        /// <summary> Deletes the object replication policy associated with the specified storage account. </summary>
 144        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 145        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 146        /// <param name="objectReplicationPolicyId"> The ID of object replication policy or &apos;default&apos; if the p
 147        /// <param name="cancellationToken"> The cancellation token to use. </param>
 148        public virtual Response Delete(string resourceGroupName, string accountName, string objectReplicationPolicyId, C
 149        {
 4150            using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.Delete");
 4151            scope.Start();
 152            try
 153            {
 4154                return RestClient.Delete(resourceGroupName, accountName, objectReplicationPolicyId, cancellationToken);
 155            }
 0156            catch (Exception e)
 157            {
 0158                scope.Failed(e);
 0159                throw;
 160            }
 4161        }
 162
 163        /// <summary> List the object replication policies associated with the storage account. </summary>
 164        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 165        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 166        /// <param name="cancellationToken"> The cancellation token to use. </param>
 167        public virtual AsyncPageable<ObjectReplicationPolicy> ListAsync(string resourceGroupName, string accountName, Ca
 168        {
 4169            if (resourceGroupName == null)
 170            {
 0171                throw new ArgumentNullException(nameof(resourceGroupName));
 172            }
 4173            if (accountName == null)
 174            {
 0175                throw new ArgumentNullException(nameof(accountName));
 176            }
 177
 178            async Task<Page<ObjectReplicationPolicy>> FirstPageFunc(int? pageSizeHint)
 179            {
 4180                using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.List");
 4181                scope.Start();
 182                try
 183                {
 4184                    var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).Configu
 4185                    return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
 186                }
 0187                catch (Exception e)
 188                {
 0189                    scope.Failed(e);
 0190                    throw;
 191                }
 4192            }
 4193            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
 194        }
 195
 196        /// <summary> List the object replication policies associated with the storage account. </summary>
 197        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 198        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 199        /// <param name="cancellationToken"> The cancellation token to use. </param>
 200        public virtual Pageable<ObjectReplicationPolicy> List(string resourceGroupName, string accountName, Cancellation
 201        {
 4202            if (resourceGroupName == null)
 203            {
 0204                throw new ArgumentNullException(nameof(resourceGroupName));
 205            }
 4206            if (accountName == null)
 207            {
 0208                throw new ArgumentNullException(nameof(accountName));
 209            }
 210
 211            Page<ObjectReplicationPolicy> FirstPageFunc(int? pageSizeHint)
 212            {
 4213                using var scope = _clientDiagnostics.CreateScope("ObjectReplicationPoliciesOperations.List");
 4214                scope.Start();
 215                try
 216                {
 4217                    var response = RestClient.List(resourceGroupName, accountName, cancellationToken);
 4218                    return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
 219                }
 0220                catch (Exception e)
 221                {
 0222                    scope.Failed(e);
 0223                    throw;
 224                }
 4225            }
 4226            return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
 227        }
 228    }
 229}