| | 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 ListQueue : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 0 | 24 | | if (Name != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("name"); |
| 0 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("properties"); |
| 0 | 35 | | writer.WriteStartObject(); |
| 0 | 36 | | if (Metadata != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("metadata"); |
| 0 | 39 | | writer.WriteStartObject(); |
| 0 | 40 | | foreach (var item in Metadata) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName(item.Key); |
| 0 | 43 | | writer.WriteStringValue(item.Value); |
| | 44 | | } |
| 0 | 45 | | writer.WriteEndObject(); |
| | 46 | | } |
| 0 | 47 | | writer.WriteEndObject(); |
| 0 | 48 | | writer.WriteEndObject(); |
| 0 | 49 | | } |
| | 50 | |
|
| | 51 | | internal static ListQueue DeserializeListQueue(JsonElement element) |
| | 52 | | { |
| 0 | 53 | | string id = default; |
| 0 | 54 | | string name = default; |
| 0 | 55 | | string type = default; |
| 0 | 56 | | IDictionary<string, string> metadata = default; |
| 0 | 57 | | foreach (var property in element.EnumerateObject()) |
| | 58 | | { |
| 0 | 59 | | if (property.NameEquals("id")) |
| | 60 | | { |
| 0 | 61 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 62 | | { |
| | 63 | | continue; |
| | 64 | | } |
| 0 | 65 | | id = property.Value.GetString(); |
| 0 | 66 | | continue; |
| | 67 | | } |
| 0 | 68 | | if (property.NameEquals("name")) |
| | 69 | | { |
| 0 | 70 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 71 | | { |
| | 72 | | continue; |
| | 73 | | } |
| 0 | 74 | | name = property.Value.GetString(); |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("type")) |
| | 78 | | { |
| 0 | 79 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 80 | | { |
| | 81 | | continue; |
| | 82 | | } |
| 0 | 83 | | type = property.Value.GetString(); |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property.NameEquals("properties")) |
| | 87 | | { |
| 0 | 88 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 89 | | { |
| 0 | 90 | | if (property0.NameEquals("metadata")) |
| | 91 | | { |
| 0 | 92 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 93 | | { |
| | 94 | | continue; |
| | 95 | | } |
| 0 | 96 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 97 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 98 | | { |
| 0 | 99 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| 0 | 101 | | dictionary.Add(property1.Name, null); |
| | 102 | | } |
| | 103 | | else |
| | 104 | | { |
| 0 | 105 | | dictionary.Add(property1.Name, property1.Value.GetString()); |
| | 106 | | } |
| | 107 | | } |
| 0 | 108 | | metadata = dictionary; |
| | 109 | | continue; |
| | 110 | | } |
| | 111 | | } |
| | 112 | | continue; |
| | 113 | | } |
| | 114 | | } |
| 0 | 115 | | return new ListQueue(id, name, type, metadata); |
| | 116 | | } |
| | 117 | | } |
| | 118 | | } |