Пример #1
0
        internal static ManagementPolicySnapShot DeserializeManagementPolicySnapShot(JsonElement element)
        {
            Optional <DateAfterCreation> delete = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("delete"))
                {
                    delete = DateAfterCreation.DeserializeDateAfterCreation(property.Value);
                    continue;
                }
            }
            return(new ManagementPolicySnapShot(delete.Value));
        }
Пример #2
0
        internal static ManagementPolicySnapShot DeserializeManagementPolicySnapShot(JsonElement element)
        {
            Optional <DateAfterCreation> tierToCool    = default;
            Optional <DateAfterCreation> tierToArchive = default;
            Optional <DateAfterCreation> delete        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tierToCool"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tierToCool = DateAfterCreation.DeserializeDateAfterCreation(property.Value);
                    continue;
                }
                if (property.NameEquals("tierToArchive"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tierToArchive = DateAfterCreation.DeserializeDateAfterCreation(property.Value);
                    continue;
                }
                if (property.NameEquals("delete"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    delete = DateAfterCreation.DeserializeDateAfterCreation(property.Value);
                    continue;
                }
            }
            return(new ManagementPolicySnapShot(tierToCool.Value, tierToArchive.Value, delete.Value));
        }