| | 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 ResourceGroup : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 112 | 18 | | writer.WriteStartObject(); |
| 112 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 112 | 24 | | if (Name != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("name"); |
| 0 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 112 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 112 | 34 | | if (Properties != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("properties"); |
| 0 | 37 | | writer.WriteObjectValue(Properties); |
| | 38 | | } |
| 112 | 39 | | writer.WritePropertyName("location"); |
| 112 | 40 | | writer.WriteStringValue(Location); |
| 112 | 41 | | if (ManagedBy != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("managedBy"); |
| 0 | 44 | | writer.WriteStringValue(ManagedBy); |
| | 45 | | } |
| 112 | 46 | | if (Tags != null) |
| | 47 | | { |
| 8 | 48 | | writer.WritePropertyName("tags"); |
| 8 | 49 | | writer.WriteStartObject(); |
| 48 | 50 | | foreach (var item in Tags) |
| | 51 | | { |
| 16 | 52 | | writer.WritePropertyName(item.Key); |
| 16 | 53 | | writer.WriteStringValue(item.Value); |
| | 54 | | } |
| 8 | 55 | | writer.WriteEndObject(); |
| | 56 | | } |
| 112 | 57 | | writer.WriteEndObject(); |
| 112 | 58 | | } |
| | 59 | |
|
| | 60 | | internal static ResourceGroup DeserializeResourceGroup(JsonElement element) |
| | 61 | | { |
| 512 | 62 | | string id = default; |
| 512 | 63 | | string name = default; |
| 512 | 64 | | string type = default; |
| 512 | 65 | | ResourceGroupProperties properties = default; |
| 512 | 66 | | string location = default; |
| 512 | 67 | | string managedBy = default; |
| 512 | 68 | | IDictionary<string, string> tags = default; |
| 6456 | 69 | | foreach (var property in element.EnumerateObject()) |
| | 70 | | { |
| 2716 | 71 | | if (property.NameEquals("id")) |
| | 72 | | { |
| 504 | 73 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 74 | | { |
| | 75 | | continue; |
| | 76 | | } |
| 504 | 77 | | id = property.Value.GetString(); |
| 504 | 78 | | continue; |
| | 79 | | } |
| 2212 | 80 | | if (property.NameEquals("name")) |
| | 81 | | { |
| 512 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 512 | 86 | | name = property.Value.GetString(); |
| 512 | 87 | | continue; |
| | 88 | | } |
| 1700 | 89 | | if (property.NameEquals("type")) |
| | 90 | | { |
| 480 | 91 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| | 93 | | continue; |
| | 94 | | } |
| 480 | 95 | | type = property.Value.GetString(); |
| 480 | 96 | | continue; |
| | 97 | | } |
| 1220 | 98 | | if (property.NameEquals("properties")) |
| | 99 | | { |
| 504 | 100 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 101 | | { |
| | 102 | | continue; |
| | 103 | | } |
| 504 | 104 | | properties = ResourceGroupProperties.DeserializeResourceGroupProperties(property.Value); |
| 504 | 105 | | continue; |
| | 106 | | } |
| 716 | 107 | | if (property.NameEquals("location")) |
| | 108 | | { |
| 512 | 109 | | location = property.Value.GetString(); |
| 512 | 110 | | continue; |
| | 111 | | } |
| 204 | 112 | | if (property.NameEquals("managedBy")) |
| | 113 | | { |
| 24 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 24 | 118 | | managedBy = property.Value.GetString(); |
| 24 | 119 | | continue; |
| | 120 | | } |
| 180 | 121 | | if (property.NameEquals("tags")) |
| | 122 | | { |
| 168 | 123 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 124 | | { |
| | 125 | | continue; |
| | 126 | | } |
| 168 | 127 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 1168 | 128 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 129 | | { |
| 416 | 130 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| 0 | 132 | | dictionary.Add(property0.Name, null); |
| | 133 | | } |
| | 134 | | else |
| | 135 | | { |
| 416 | 136 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 137 | | } |
| | 138 | | } |
| 168 | 139 | | tags = dictionary; |
| | 140 | | continue; |
| | 141 | | } |
| | 142 | | } |
| 512 | 143 | | return new ResourceGroup(id, name, type, properties, location, managedBy, tags); |
| | 144 | | } |
| | 145 | | } |
| | 146 | | } |