< Summary

Class:Azure.ResourceManager.Storage.Models.RestorePolicyProperties
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\RestorePolicyProperties.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\RestorePolicyProperties.Serialization.cs
Covered lines:0
Uncovered lines:37
Coverable lines:37
Total lines:108
Line coverage:0% (0 of 37)
Covered branches:0
Total branches:16
Branch coverage:0% (0 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-0%100%
get_Enabled()-0%100%
get_Days()-0%100%
get_LastEnabledTime()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeRestorePolicyProperties(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\RestorePolicyProperties.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;
 9
 10namespace Azure.ResourceManager.Storage.Models
 11{
 12    /// <summary> The blob service properties for blob restore policy. </summary>
 13    public partial class RestorePolicyProperties
 14    {
 15        /// <summary> Initializes a new instance of RestorePolicyProperties. </summary>
 16        /// <param name="enabled"> Blob restore is enabled if set to true. </param>
 017        public RestorePolicyProperties(bool enabled)
 18        {
 019            Enabled = enabled;
 020        }
 21
 22        /// <summary> Initializes a new instance of RestorePolicyProperties. </summary>
 23        /// <param name="enabled"> Blob restore is enabled if set to true. </param>
 24        /// <param name="days"> how long this blob can be restored. It should be great than zero and less than DeleteRet
 25        /// <param name="lastEnabledTime"> Returns the date and time the restore policy was last enabled. </param>
 026        internal RestorePolicyProperties(bool enabled, int? days, DateTimeOffset? lastEnabledTime)
 27        {
 028            Enabled = enabled;
 029            Days = days;
 030            LastEnabledTime = lastEnabledTime;
 031        }
 32
 33        /// <summary> Blob restore is enabled if set to true. </summary>
 034        public bool Enabled { get; set; }
 35        /// <summary> how long this blob can be restored. It should be great than zero and less than DeleteRetentionPoli
 036        public int? Days { get; set; }
 37        /// <summary> Returns the date and time the restore policy was last enabled. </summary>
 038        public DateTimeOffset? LastEnabledTime { get; }
 39    }
 40}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\RestorePolicyProperties.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.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Storage.Models
 13{
 14    public partial class RestorePolicyProperties : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("enabled");
 020            writer.WriteBooleanValue(Enabled);
 021            if (Days != null)
 22            {
 023                writer.WritePropertyName("days");
 024                writer.WriteNumberValue(Days.Value);
 25            }
 026            if (LastEnabledTime != null)
 27            {
 028                writer.WritePropertyName("lastEnabledTime");
 029                writer.WriteStringValue(LastEnabledTime.Value, "O");
 30            }
 031            writer.WriteEndObject();
 032        }
 33
 34        internal static RestorePolicyProperties DeserializeRestorePolicyProperties(JsonElement element)
 35        {
 036            bool enabled = default;
 037            int? days = default;
 038            DateTimeOffset? lastEnabledTime = default;
 039            foreach (var property in element.EnumerateObject())
 40            {
 041                if (property.NameEquals("enabled"))
 42                {
 043                    enabled = property.Value.GetBoolean();
 044                    continue;
 45                }
 046                if (property.NameEquals("days"))
 47                {
 048                    if (property.Value.ValueKind == JsonValueKind.Null)
 49                    {
 50                        continue;
 51                    }
 052                    days = property.Value.GetInt32();
 053                    continue;
 54                }
 055                if (property.NameEquals("lastEnabledTime"))
 56                {
 057                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 061                    lastEnabledTime = property.Value.GetDateTimeOffset("O");
 62                    continue;
 63                }
 64            }
 065            return new RestorePolicyProperties(enabled, days, lastEnabledTime);
 66        }
 67    }
 68}