| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class LegalHold : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (HasLegalHold != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("hasLegalHold"); |
| 0 | 22 | | writer.WriteBooleanValue(HasLegalHold.Value); |
| | 23 | | } |
| 16 | 24 | | writer.WritePropertyName("tags"); |
| 16 | 25 | | writer.WriteStartArray(); |
| 128 | 26 | | foreach (var item in Tags) |
| | 27 | | { |
| 48 | 28 | | writer.WriteStringValue(item); |
| | 29 | | } |
| 16 | 30 | | writer.WriteEndArray(); |
| 16 | 31 | | writer.WriteEndObject(); |
| 16 | 32 | | } |
| | 33 | |
|
| | 34 | | internal static LegalHold DeserializeLegalHold(JsonElement element) |
| | 35 | | { |
| 16 | 36 | | bool? hasLegalHold = default; |
| 16 | 37 | | IList<string> tags = default; |
| 96 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 32 | 40 | | if (property.NameEquals("hasLegalHold")) |
| | 41 | | { |
| 16 | 42 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 43 | | { |
| | 44 | | continue; |
| | 45 | | } |
| 16 | 46 | | hasLegalHold = property.Value.GetBoolean(); |
| 16 | 47 | | continue; |
| | 48 | | } |
| 16 | 49 | | if (property.NameEquals("tags")) |
| | 50 | | { |
| 16 | 51 | | List<string> array = new List<string>(); |
| 80 | 52 | | foreach (var item in property.Value.EnumerateArray()) |
| | 53 | | { |
| 24 | 54 | | if (item.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| 0 | 56 | | array.Add(null); |
| | 57 | | } |
| | 58 | | else |
| | 59 | | { |
| 24 | 60 | | array.Add(item.GetString()); |
| | 61 | | } |
| | 62 | | } |
| 16 | 63 | | tags = array; |
| | 64 | | continue; |
| | 65 | | } |
| | 66 | | } |
| 16 | 67 | | return new LegalHold(hasLegalHold, tags); |
| | 68 | | } |
| | 69 | | } |
| | 70 | | } |