< Summary

Class:Azure.ResourceManager.Storage.Models.ObjectReplicationPolicy
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicy.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicy.Serialization.cs
Covered lines:86
Uncovered lines:9
Coverable lines:95
Total lines:228
Line coverage:90.5% (86 of 95)
Covered branches:55
Total branches:60
Branch coverage:91.6% (55 of 60)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_PolicyId()-100%100%
get_EnabledTime()-100%100%
get_SourceAccount()-100%100%
get_DestinationAccount()-100%100%
get_Rules()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-75.76%77.78%
DeserializeObjectReplicationPolicy(...)-97.92%97.62%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicy.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.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Storage.Models
 12{
 13    /// <summary> The replication policy between two storage accounts. Multiple rules can be defined in one policy. </su
 14    public partial class ObjectReplicationPolicy : Resource
 15    {
 16        /// <summary> Initializes a new instance of ObjectReplicationPolicy. </summary>
 417        public ObjectReplicationPolicy()
 18        {
 419        }
 20
 21        /// <summary> Initializes a new instance of ObjectReplicationPolicy. </summary>
 22        /// <param name="id"> Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourc
 23        /// <param name="name"> The name of the resource. </param>
 24        /// <param name="type"> The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/sto
 25        /// <param name="policyId"> A unique id for object replication policy. </param>
 26        /// <param name="enabledTime"> Indicates when the policy is enabled on the source account. </param>
 27        /// <param name="sourceAccount"> Required. Source account name. </param>
 28        /// <param name="destinationAccount"> Required. Destination account name. </param>
 29        /// <param name="rules"> The storage account object replication rules. </param>
 2430        internal ObjectReplicationPolicy(string id, string name, string type, string policyId, DateTimeOffset? enabledTi
 31        {
 2432            PolicyId = policyId;
 2433            EnabledTime = enabledTime;
 2434            SourceAccount = sourceAccount;
 2435            DestinationAccount = destinationAccount;
 2436            Rules = rules;
 2437        }
 38
 39        /// <summary> A unique id for object replication policy. </summary>
 5240        public string PolicyId { get; }
 41        /// <summary> Indicates when the policy is enabled on the source account. </summary>
 842        public DateTimeOffset? EnabledTime { get; }
 43        /// <summary> Required. Source account name. </summary>
 7644        public string SourceAccount { get; set; }
 45        /// <summary> Required. Destination account name. </summary>
 7646        public string DestinationAccount { get; set; }
 47        /// <summary> The storage account object replication rules. </summary>
 14048        public IList<ObjectReplicationPolicyRule> Rules { get; set; }
 49    }
 50}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicy.Serialization.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.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.Storage.Models
 14{
 15    public partial class ObjectReplicationPolicy : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 819            writer.WriteStartObject();
 820            if (Id != null)
 21            {
 022                writer.WritePropertyName("id");
 023                writer.WriteStringValue(Id);
 24            }
 825            if (Name != null)
 26            {
 027                writer.WritePropertyName("name");
 028                writer.WriteStringValue(Name);
 29            }
 830            if (Type != null)
 31            {
 032                writer.WritePropertyName("type");
 033                writer.WriteStringValue(Type);
 34            }
 835            writer.WritePropertyName("properties");
 836            writer.WriteStartObject();
 837            if (PolicyId != null)
 38            {
 439                writer.WritePropertyName("policyId");
 440                writer.WriteStringValue(PolicyId);
 41            }
 842            if (EnabledTime != null)
 43            {
 044                writer.WritePropertyName("enabledTime");
 045                writer.WriteStringValue(EnabledTime.Value, "O");
 46            }
 847            if (SourceAccount != null)
 48            {
 849                writer.WritePropertyName("sourceAccount");
 850                writer.WriteStringValue(SourceAccount);
 51            }
 852            if (DestinationAccount != null)
 53            {
 854                writer.WritePropertyName("destinationAccount");
 855                writer.WriteStringValue(DestinationAccount);
 56            }
 857            if (Rules != null)
 58            {
 859                writer.WritePropertyName("rules");
 860                writer.WriteStartArray();
 4861                foreach (var item in Rules)
 62                {
 1663                    writer.WriteObjectValue(item);
 64                }
 865                writer.WriteEndArray();
 66            }
 867            writer.WriteEndObject();
 868            writer.WriteEndObject();
 869        }
 70
 71        internal static ObjectReplicationPolicy DeserializeObjectReplicationPolicy(JsonElement element)
 72        {
 2473            string id = default;
 2474            string name = default;
 2475            string type = default;
 2476            string policyId = default;
 2477            DateTimeOffset? enabledTime = default;
 2478            string sourceAccount = default;
 2479            string destinationAccount = default;
 2480            IList<ObjectReplicationPolicyRule> rules = default;
 19281            foreach (var property in element.EnumerateObject())
 82            {
 7283                if (property.NameEquals("id"))
 84                {
 1685                    if (property.Value.ValueKind == JsonValueKind.Null)
 86                    {
 87                        continue;
 88                    }
 1689                    id = property.Value.GetString();
 1690                    continue;
 91                }
 5692                if (property.NameEquals("name"))
 93                {
 1694                    if (property.Value.ValueKind == JsonValueKind.Null)
 95                    {
 96                        continue;
 97                    }
 1698                    name = property.Value.GetString();
 1699                    continue;
 100                }
 40101                if (property.NameEquals("type"))
 102                {
 16103                    if (property.Value.ValueKind == JsonValueKind.Null)
 104                    {
 105                        continue;
 106                    }
 16107                    type = property.Value.GetString();
 16108                    continue;
 109                }
 24110                if (property.NameEquals("properties"))
 111                {
 248112                    foreach (var property0 in property.Value.EnumerateObject())
 113                    {
 100114                        if (property0.NameEquals("policyId"))
 115                        {
 24116                            if (property0.Value.ValueKind == JsonValueKind.Null)
 117                            {
 118                                continue;
 119                            }
 24120                            policyId = property0.Value.GetString();
 24121                            continue;
 122                        }
 76123                        if (property0.NameEquals("enabledTime"))
 124                        {
 4125                            if (property0.Value.ValueKind == JsonValueKind.Null)
 126                            {
 127                                continue;
 128                            }
 4129                            enabledTime = property0.Value.GetDateTimeOffset("O");
 4130                            continue;
 131                        }
 72132                        if (property0.NameEquals("sourceAccount"))
 133                        {
 24134                            if (property0.Value.ValueKind == JsonValueKind.Null)
 135                            {
 136                                continue;
 137                            }
 24138                            sourceAccount = property0.Value.GetString();
 24139                            continue;
 140                        }
 48141                        if (property0.NameEquals("destinationAccount"))
 142                        {
 24143                            if (property0.Value.ValueKind == JsonValueKind.Null)
 144                            {
 145                                continue;
 146                            }
 24147                            destinationAccount = property0.Value.GetString();
 24148                            continue;
 149                        }
 24150                        if (property0.NameEquals("rules"))
 151                        {
 24152                            if (property0.Value.ValueKind == JsonValueKind.Null)
 153                            {
 154                                continue;
 155                            }
 24156                            List<ObjectReplicationPolicyRule> array = new List<ObjectReplicationPolicyRule>();
 144157                            foreach (var item in property0.Value.EnumerateArray())
 158                            {
 48159                                if (item.ValueKind == JsonValueKind.Null)
 160                                {
 0161                                    array.Add(null);
 162                                }
 163                                else
 164                                {
 48165                                    array.Add(ObjectReplicationPolicyRule.DeserializeObjectReplicationPolicyRule(item));
 166                                }
 167                            }
 24168                            rules = array;
 169                            continue;
 170                        }
 171                    }
 172                    continue;
 173                }
 174            }
 24175            return new ObjectReplicationPolicy(id, name, type, policyId, enabledTime, sourceAccount, destinationAccount,
 176        }
 177    }
 178}