| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Storage.Models |
| | 12 | | { |
| | 13 | | public partial class ManagementPolicyBaseBlob : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 8 | 17 | | writer.WriteStartObject(); |
| 8 | 18 | | if (TierToCool != null) |
| | 19 | | { |
| 4 | 20 | | writer.WritePropertyName("tierToCool"); |
| 4 | 21 | | writer.WriteObjectValue(TierToCool); |
| | 22 | | } |
| 8 | 23 | | if (TierToArchive != null) |
| | 24 | | { |
| 4 | 25 | | writer.WritePropertyName("tierToArchive"); |
| 4 | 26 | | writer.WriteObjectValue(TierToArchive); |
| | 27 | | } |
| 8 | 28 | | if (Delete != null) |
| | 29 | | { |
| 8 | 30 | | writer.WritePropertyName("delete"); |
| 8 | 31 | | writer.WriteObjectValue(Delete); |
| | 32 | | } |
| 8 | 33 | | writer.WriteEndObject(); |
| 8 | 34 | | } |
| | 35 | |
|
| | 36 | | internal static ManagementPolicyBaseBlob DeserializeManagementPolicyBaseBlob(JsonElement element) |
| | 37 | | { |
| 16 | 38 | | DateAfterModification tierToCool = default; |
| 16 | 39 | | DateAfterModification tierToArchive = default; |
| 16 | 40 | | DateAfterModification delete = default; |
| 96 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 32 | 43 | | if (property.NameEquals("tierToCool")) |
| | 44 | | { |
| 8 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 8 | 49 | | tierToCool = DateAfterModification.DeserializeDateAfterModification(property.Value); |
| 8 | 50 | | continue; |
| | 51 | | } |
| 24 | 52 | | if (property.NameEquals("tierToArchive")) |
| | 53 | | { |
| 8 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 8 | 58 | | tierToArchive = DateAfterModification.DeserializeDateAfterModification(property.Value); |
| 8 | 59 | | continue; |
| | 60 | | } |
| 16 | 61 | | if (property.NameEquals("delete")) |
| | 62 | | { |
| 16 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 16 | 67 | | delete = DateAfterModification.DeserializeDateAfterModification(property.Value); |
| | 68 | | continue; |
| | 69 | | } |
| | 70 | | } |
| 16 | 71 | | return new ManagementPolicyBaseBlob(tierToCool, tierToArchive, delete); |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |