| | 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.Resources.Models |
| | 13 | | { |
| | 14 | | public partial class Tags : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 56 | 18 | | writer.WriteStartObject(); |
| 56 | 19 | | if (TagsValue != null) |
| | 20 | | { |
| 56 | 21 | | writer.WritePropertyName("tags"); |
| 56 | 22 | | writer.WriteStartObject(); |
| 336 | 23 | | foreach (var item in TagsValue) |
| | 24 | | { |
| 112 | 25 | | writer.WritePropertyName(item.Key); |
| 112 | 26 | | writer.WriteStringValue(item.Value); |
| | 27 | | } |
| 56 | 28 | | writer.WriteEndObject(); |
| | 29 | | } |
| 56 | 30 | | writer.WriteEndObject(); |
| 56 | 31 | | } |
| | 32 | |
|
| | 33 | | internal static Tags DeserializeTags(JsonElement element) |
| | 34 | | { |
| 72 | 35 | | IDictionary<string, string> tags = default; |
| 280 | 36 | | foreach (var property in element.EnumerateObject()) |
| | 37 | | { |
| 68 | 38 | | if (property.NameEquals("tags")) |
| | 39 | | { |
| 68 | 40 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 41 | | { |
| | 42 | | continue; |
| | 43 | | } |
| 68 | 44 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 376 | 45 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 46 | | { |
| 120 | 47 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| 0 | 49 | | dictionary.Add(property0.Name, null); |
| | 50 | | } |
| | 51 | | else |
| | 52 | | { |
| 120 | 53 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 54 | | } |
| | 55 | | } |
| 68 | 56 | | tags = dictionary; |
| | 57 | | continue; |
| | 58 | | } |
| | 59 | | } |
| 72 | 60 | | return new Tags(tags); |
| | 61 | | } |
| | 62 | | } |
| | 63 | | } |