| | 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; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Resources.Models |
| | 14 | | { |
| | 15 | | public partial class GenericResourceExpanded : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | if (CreatedTime != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("createdTime"); |
| 0 | 23 | | writer.WriteStringValue(CreatedTime.Value, "O"); |
| | 24 | | } |
| 0 | 25 | | if (ChangedTime != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("changedTime"); |
| 0 | 28 | | writer.WriteStringValue(ChangedTime.Value, "O"); |
| | 29 | | } |
| 0 | 30 | | if (ProvisioningState != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("provisioningState"); |
| 0 | 33 | | writer.WriteStringValue(ProvisioningState); |
| | 34 | | } |
| 0 | 35 | | if (Plan != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("plan"); |
| 0 | 38 | | writer.WriteObjectValue(Plan); |
| | 39 | | } |
| 0 | 40 | | if (Properties != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("properties"); |
| 0 | 43 | | writer.WriteObjectValue(Properties); |
| | 44 | | } |
| 0 | 45 | | if (Kind != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("kind"); |
| 0 | 48 | | writer.WriteStringValue(Kind); |
| | 49 | | } |
| 0 | 50 | | if (ManagedBy != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("managedBy"); |
| 0 | 53 | | writer.WriteStringValue(ManagedBy); |
| | 54 | | } |
| 0 | 55 | | if (Sku != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("sku"); |
| 0 | 58 | | writer.WriteObjectValue(Sku); |
| | 59 | | } |
| 0 | 60 | | if (Identity != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("identity"); |
| 0 | 63 | | writer.WriteObjectValue(Identity); |
| | 64 | | } |
| 0 | 65 | | if (Id != null) |
| | 66 | | { |
| 0 | 67 | | writer.WritePropertyName("id"); |
| 0 | 68 | | writer.WriteStringValue(Id); |
| | 69 | | } |
| 0 | 70 | | if (Name != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("name"); |
| 0 | 73 | | writer.WriteStringValue(Name); |
| | 74 | | } |
| 0 | 75 | | if (Type != null) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName("type"); |
| 0 | 78 | | writer.WriteStringValue(Type); |
| | 79 | | } |
| 0 | 80 | | if (Location != null) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("location"); |
| 0 | 83 | | writer.WriteStringValue(Location); |
| | 84 | | } |
| 0 | 85 | | if (Tags != null) |
| | 86 | | { |
| 0 | 87 | | writer.WritePropertyName("tags"); |
| 0 | 88 | | writer.WriteStartObject(); |
| 0 | 89 | | foreach (var item in Tags) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName(item.Key); |
| 0 | 92 | | writer.WriteStringValue(item.Value); |
| | 93 | | } |
| 0 | 94 | | writer.WriteEndObject(); |
| | 95 | | } |
| 0 | 96 | | writer.WriteEndObject(); |
| 0 | 97 | | } |
| | 98 | |
|
| | 99 | | internal static GenericResourceExpanded DeserializeGenericResourceExpanded(JsonElement element) |
| | 100 | | { |
| 250 | 101 | | DateTimeOffset? createdTime = default; |
| 250 | 102 | | DateTimeOffset? changedTime = default; |
| 250 | 103 | | string provisioningState = default; |
| 250 | 104 | | Plan plan = default; |
| 250 | 105 | | object properties = default; |
| 250 | 106 | | string kind = default; |
| 250 | 107 | | string managedBy = default; |
| 250 | 108 | | Sku sku = default; |
| 250 | 109 | | Identity identity = default; |
| 250 | 110 | | string id = default; |
| 250 | 111 | | string name = default; |
| 250 | 112 | | string type = default; |
| 250 | 113 | | string location = default; |
| 250 | 114 | | IDictionary<string, string> tags = default; |
| 3160 | 115 | | foreach (var property in element.EnumerateObject()) |
| | 116 | | { |
| 1330 | 117 | | if (property.NameEquals("createdTime")) |
| | 118 | | { |
| 0 | 119 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 120 | | { |
| | 121 | | continue; |
| | 122 | | } |
| 0 | 123 | | createdTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 124 | | continue; |
| | 125 | | } |
| 1330 | 126 | | if (property.NameEquals("changedTime")) |
| | 127 | | { |
| 0 | 128 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 129 | | { |
| | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | changedTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 133 | | continue; |
| | 134 | | } |
| 1330 | 135 | | if (property.NameEquals("provisioningState")) |
| | 136 | | { |
| 0 | 137 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 138 | | { |
| | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | provisioningState = property.Value.GetString(); |
| 0 | 142 | | continue; |
| | 143 | | } |
| 1330 | 144 | | if (property.NameEquals("plan")) |
| | 145 | | { |
| 2 | 146 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 147 | | { |
| | 148 | | continue; |
| | 149 | | } |
| 2 | 150 | | plan = Plan.DeserializePlan(property.Value); |
| 2 | 151 | | continue; |
| | 152 | | } |
| 1328 | 153 | | if (property.NameEquals("properties")) |
| | 154 | | { |
| 8 | 155 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 156 | | { |
| | 157 | | continue; |
| | 158 | | } |
| 8 | 159 | | properties = property.Value.GetObject(); |
| 8 | 160 | | continue; |
| | 161 | | } |
| 1320 | 162 | | if (property.NameEquals("kind")) |
| | 163 | | { |
| 80 | 164 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 165 | | { |
| | 166 | | continue; |
| | 167 | | } |
| 80 | 168 | | kind = property.Value.GetString(); |
| 80 | 169 | | continue; |
| | 170 | | } |
| 1240 | 171 | | if (property.NameEquals("managedBy")) |
| | 172 | | { |
| 20 | 173 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| | 175 | | continue; |
| | 176 | | } |
| 20 | 177 | | managedBy = property.Value.GetString(); |
| 20 | 178 | | continue; |
| | 179 | | } |
| 1220 | 180 | | if (property.NameEquals("sku")) |
| | 181 | | { |
| 120 | 182 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 183 | | { |
| | 184 | | continue; |
| | 185 | | } |
| 120 | 186 | | sku = Sku.DeserializeSku(property.Value); |
| 120 | 187 | | continue; |
| | 188 | | } |
| 1100 | 189 | | if (property.NameEquals("identity")) |
| | 190 | | { |
| 0 | 191 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 192 | | { |
| | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | identity = Identity.DeserializeIdentity(property.Value); |
| 0 | 196 | | continue; |
| | 197 | | } |
| 1100 | 198 | | if (property.NameEquals("id")) |
| | 199 | | { |
| 250 | 200 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| | 202 | | continue; |
| | 203 | | } |
| 250 | 204 | | id = property.Value.GetString(); |
| 250 | 205 | | continue; |
| | 206 | | } |
| 850 | 207 | | if (property.NameEquals("name")) |
| | 208 | | { |
| 250 | 209 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| | 211 | | continue; |
| | 212 | | } |
| 250 | 213 | | name = property.Value.GetString(); |
| 250 | 214 | | continue; |
| | 215 | | } |
| 600 | 216 | | if (property.NameEquals("type")) |
| | 217 | | { |
| 234 | 218 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| | 220 | | continue; |
| | 221 | | } |
| 234 | 222 | | type = property.Value.GetString(); |
| 234 | 223 | | continue; |
| | 224 | | } |
| 366 | 225 | | if (property.NameEquals("location")) |
| | 226 | | { |
| 250 | 227 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 228 | | { |
| | 229 | | continue; |
| | 230 | | } |
| 250 | 231 | | location = property.Value.GetString(); |
| 250 | 232 | | continue; |
| | 233 | | } |
| 116 | 234 | | if (property.NameEquals("tags")) |
| | 235 | | { |
| 100 | 236 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 237 | | { |
| | 238 | | continue; |
| | 239 | | } |
| 100 | 240 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 276 | 241 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 242 | | { |
| 38 | 243 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 244 | | { |
| 0 | 245 | | dictionary.Add(property0.Name, null); |
| | 246 | | } |
| | 247 | | else |
| | 248 | | { |
| 38 | 249 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 250 | | } |
| | 251 | | } |
| 100 | 252 | | tags = dictionary; |
| | 253 | | continue; |
| | 254 | | } |
| | 255 | | } |
| 250 | 256 | | return new GenericResourceExpanded(id, name, type, location, tags, plan, properties, kind, managedBy, sku, i |
| | 257 | | } |
| | 258 | | } |
| | 259 | | } |