| | 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.Resources.Models |
| | 12 | | { |
| | 13 | | public partial class TagsResource : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 32 | 17 | | writer.WriteStartObject(); |
| 32 | 18 | | if (Id != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("id"); |
| 0 | 21 | | writer.WriteStringValue(Id); |
| | 22 | | } |
| 32 | 23 | | if (Name != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("name"); |
| 0 | 26 | | writer.WriteStringValue(Name); |
| | 27 | | } |
| 32 | 28 | | if (Type != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("type"); |
| 0 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 32 | 33 | | writer.WritePropertyName("properties"); |
| 32 | 34 | | writer.WriteObjectValue(Properties); |
| 32 | 35 | | writer.WriteEndObject(); |
| 32 | 36 | | } |
| | 37 | |
|
| | 38 | | internal static TagsResource DeserializeTagsResource(JsonElement element) |
| | 39 | | { |
| 72 | 40 | | string id = default; |
| 72 | 41 | | string name = default; |
| 72 | 42 | | string type = default; |
| 72 | 43 | | Tags properties = default; |
| 720 | 44 | | foreach (var property in element.EnumerateObject()) |
| | 45 | | { |
| 288 | 46 | | if (property.NameEquals("id")) |
| | 47 | | { |
| 72 | 48 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 49 | | { |
| | 50 | | continue; |
| | 51 | | } |
| 72 | 52 | | id = property.Value.GetString(); |
| 72 | 53 | | continue; |
| | 54 | | } |
| 216 | 55 | | if (property.NameEquals("name")) |
| | 56 | | { |
| 72 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 58 | | { |
| | 59 | | continue; |
| | 60 | | } |
| 72 | 61 | | name = property.Value.GetString(); |
| 72 | 62 | | continue; |
| | 63 | | } |
| 144 | 64 | | if (property.NameEquals("type")) |
| | 65 | | { |
| 72 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 72 | 70 | | type = property.Value.GetString(); |
| 72 | 71 | | continue; |
| | 72 | | } |
| 72 | 73 | | if (property.NameEquals("properties")) |
| | 74 | | { |
| 72 | 75 | | properties = Tags.DeserializeTags(property.Value); |
| | 76 | | continue; |
| | 77 | | } |
| | 78 | | } |
| 72 | 79 | | return new TagsResource(id, name, type, properties); |
| | 80 | | } |
| | 81 | | } |
| | 82 | | } |