| | | 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.Compute.Models |
| | | 12 | | { |
| | | 13 | | public partial class Sku : IUtf8JsonSerializable |
| | | 14 | | { |
| | | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 16 | | { |
| | 488 | 17 | | writer.WriteStartObject(); |
| | 488 | 18 | | if (Name != null) |
| | | 19 | | { |
| | 488 | 20 | | writer.WritePropertyName("name"); |
| | 488 | 21 | | writer.WriteStringValue(Name); |
| | | 22 | | } |
| | 488 | 23 | | if (Tier != null) |
| | | 24 | | { |
| | 48 | 25 | | writer.WritePropertyName("tier"); |
| | 48 | 26 | | writer.WriteStringValue(Tier); |
| | | 27 | | } |
| | 488 | 28 | | if (Capacity != null) |
| | | 29 | | { |
| | 364 | 30 | | writer.WritePropertyName("capacity"); |
| | 364 | 31 | | writer.WriteNumberValue(Capacity.Value); |
| | | 32 | | } |
| | 488 | 33 | | writer.WriteEndObject(); |
| | 488 | 34 | | } |
| | | 35 | | |
| | | 36 | | internal static Sku DeserializeSku(JsonElement element) |
| | | 37 | | { |
| | 2884 | 38 | | string name = default; |
| | 2884 | 39 | | string tier = default; |
| | 2884 | 40 | | long? capacity = default; |
| | 17816 | 41 | | foreach (var property in element.EnumerateObject()) |
| | | 42 | | { |
| | 6024 | 43 | | if (property.NameEquals("name")) |
| | | 44 | | { |
| | 2884 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 46 | | { |
| | | 47 | | continue; |
| | | 48 | | } |
| | 2884 | 49 | | name = property.Value.GetString(); |
| | 2884 | 50 | | continue; |
| | | 51 | | } |
| | 3140 | 52 | | if (property.NameEquals("tier")) |
| | | 53 | | { |
| | 2692 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 55 | | { |
| | | 56 | | continue; |
| | | 57 | | } |
| | 2692 | 58 | | tier = property.Value.GetString(); |
| | 2692 | 59 | | continue; |
| | | 60 | | } |
| | 448 | 61 | | if (property.NameEquals("capacity")) |
| | | 62 | | { |
| | 448 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 64 | | { |
| | | 65 | | continue; |
| | | 66 | | } |
| | 448 | 67 | | capacity = property.Value.GetInt64(); |
| | | 68 | | continue; |
| | | 69 | | } |
| | | 70 | | } |
| | 2884 | 71 | | return new Sku(name, tier, capacity); |
| | | 72 | | } |
| | | 73 | | } |
| | | 74 | | } |