< Summary

Class:Azure.ResourceManager.Storage.Models.ImmutabilityPolicyProperties
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ImmutabilityPolicyProperties.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ImmutabilityPolicyProperties.Serialization.cs
Covered lines:37
Uncovered lines:34
Coverable lines:71
Total lines:178
Line coverage:52.1% (37 of 71)
Covered branches:26
Total branches:42
Branch coverage:61.9% (26 of 42)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Etag()-0%100%
get_UpdateHistory()-100%100%
get_ImmutabilityPeriodSinceCreationInDays()-0%100%
get_State()-0%100%
get_AllowProtectedAppendWrites()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeImmutabilityPolicyProperties(...)-87.88%86.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ImmutabilityPolicyProperties.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.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Storage.Models
 11{
 12    /// <summary> The properties of an ImmutabilityPolicy of a blob container. </summary>
 13    public partial class ImmutabilityPolicyProperties
 14    {
 15        /// <summary> Initializes a new instance of ImmutabilityPolicyProperties. </summary>
 016        public ImmutabilityPolicyProperties()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of ImmutabilityPolicyProperties. </summary>
 21        /// <param name="etag"> ImmutabilityPolicy Etag. </param>
 22        /// <param name="updateHistory"> The ImmutabilityPolicy update history of the blob container. </param>
 23        /// <param name="immutabilityPeriodSinceCreationInDays"> The immutability period for the blobs in the container 
 24        /// <param name="state"> The ImmutabilityPolicy state of a blob container, possible values include: Locked and U
 25        /// <param name="allowProtectedAppendWrites"> This property can only be changed for unlocked time-based retentio
 426        internal ImmutabilityPolicyProperties(string etag, IList<UpdateHistoryProperty> updateHistory, int? immutability
 27        {
 428            Etag = etag;
 429            UpdateHistory = updateHistory;
 430            ImmutabilityPeriodSinceCreationInDays = immutabilityPeriodSinceCreationInDays;
 431            State = state;
 432            AllowProtectedAppendWrites = allowProtectedAppendWrites;
 433        }
 34
 35        /// <summary> ImmutabilityPolicy Etag. </summary>
 036        public string Etag { get; }
 37        /// <summary> The ImmutabilityPolicy update history of the blob container. </summary>
 1638        public IList<UpdateHistoryProperty> UpdateHistory { get; }
 39        /// <summary> The immutability period for the blobs in the container since the policy creation, in days. </summa
 040        public int? ImmutabilityPeriodSinceCreationInDays { get; set; }
 41        /// <summary> The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. </
 042        public ImmutabilityPolicyState? State { get; }
 43        /// <summary> This property can only be changed for unlocked time-based retention policies. When enabled, new bl
 044        public bool? AllowProtectedAppendWrites { get; set; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ImmutabilityPolicyProperties.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Storage.Models
 13{
 14    public partial class ImmutabilityPolicyProperties : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Etag != null)
 20            {
 021                writer.WritePropertyName("etag");
 022                writer.WriteStringValue(Etag);
 23            }
 024            if (UpdateHistory != null)
 25            {
 026                writer.WritePropertyName("updateHistory");
 027                writer.WriteStartArray();
 028                foreach (var item in UpdateHistory)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 034            writer.WritePropertyName("properties");
 035            writer.WriteStartObject();
 036            if (ImmutabilityPeriodSinceCreationInDays != null)
 37            {
 038                writer.WritePropertyName("immutabilityPeriodSinceCreationInDays");
 039                writer.WriteNumberValue(ImmutabilityPeriodSinceCreationInDays.Value);
 40            }
 041            if (State != null)
 42            {
 043                writer.WritePropertyName("state");
 044                writer.WriteStringValue(State.Value.ToString());
 45            }
 046            if (AllowProtectedAppendWrites != null)
 47            {
 048                writer.WritePropertyName("allowProtectedAppendWrites");
 049                writer.WriteBooleanValue(AllowProtectedAppendWrites.Value);
 50            }
 051            writer.WriteEndObject();
 052            writer.WriteEndObject();
 053        }
 54
 55        internal static ImmutabilityPolicyProperties DeserializeImmutabilityPolicyProperties(JsonElement element)
 56        {
 457            string etag = default;
 458            IList<UpdateHistoryProperty> updateHistory = default;
 459            int? immutabilityPeriodSinceCreationInDays = default;
 460            ImmutabilityPolicyState? state = default;
 461            bool? allowProtectedAppendWrites = default;
 3262            foreach (var property in element.EnumerateObject())
 63            {
 1264                if (property.NameEquals("etag"))
 65                {
 466                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 470                    etag = property.Value.GetString();
 471                    continue;
 72                }
 873                if (property.NameEquals("updateHistory"))
 74                {
 475                    if (property.Value.ValueKind == JsonValueKind.Null)
 76                    {
 77                        continue;
 78                    }
 479                    List<UpdateHistoryProperty> array = new List<UpdateHistoryProperty>();
 3280                    foreach (var item in property.Value.EnumerateArray())
 81                    {
 1282                        if (item.ValueKind == JsonValueKind.Null)
 83                        {
 084                            array.Add(null);
 85                        }
 86                        else
 87                        {
 1288                            array.Add(UpdateHistoryProperty.DeserializeUpdateHistoryProperty(item));
 89                        }
 90                    }
 491                    updateHistory = array;
 492                    continue;
 93                }
 494                if (property.NameEquals("properties"))
 95                {
 2496                    foreach (var property0 in property.Value.EnumerateObject())
 97                    {
 898                        if (property0.NameEquals("immutabilityPeriodSinceCreationInDays"))
 99                        {
 4100                            if (property0.Value.ValueKind == JsonValueKind.Null)
 101                            {
 102                                continue;
 103                            }
 4104                            immutabilityPeriodSinceCreationInDays = property0.Value.GetInt32();
 4105                            continue;
 106                        }
 4107                        if (property0.NameEquals("state"))
 108                        {
 4109                            if (property0.Value.ValueKind == JsonValueKind.Null)
 110                            {
 111                                continue;
 112                            }
 4113                            state = new ImmutabilityPolicyState(property0.Value.GetString());
 4114                            continue;
 115                        }
 0116                        if (property0.NameEquals("allowProtectedAppendWrites"))
 117                        {
 0118                            if (property0.Value.ValueKind == JsonValueKind.Null)
 119                            {
 120                                continue;
 121                            }
 0122                            allowProtectedAppendWrites = property0.Value.GetBoolean();
 123                            continue;
 124                        }
 125                    }
 126                    continue;
 127                }
 128            }
 4129            return new ImmutabilityPolicyProperties(etag, updateHistory, immutabilityPeriodSinceCreationInDays, state, a
 130        }
 131    }
 132}