| | 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 Sku : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 72 | 17 | | writer.WriteStartObject(); |
| 72 | 18 | | if (Name != null) |
| | 19 | | { |
| 72 | 20 | | writer.WritePropertyName("name"); |
| 72 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 72 | 23 | | if (Tier != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("tier"); |
| 0 | 26 | | writer.WriteStringValue(Tier); |
| | 27 | | } |
| 72 | 28 | | if (Size != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("size"); |
| 0 | 31 | | writer.WriteStringValue(Size); |
| | 32 | | } |
| 72 | 33 | | if (Family != null) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName("family"); |
| 0 | 36 | | writer.WriteStringValue(Family); |
| | 37 | | } |
| 72 | 38 | | if (Model != null) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("model"); |
| 0 | 41 | | writer.WriteStringValue(Model); |
| | 42 | | } |
| 72 | 43 | | if (Capacity != null) |
| | 44 | | { |
| 0 | 45 | | writer.WritePropertyName("capacity"); |
| 0 | 46 | | writer.WriteNumberValue(Capacity.Value); |
| | 47 | | } |
| 72 | 48 | | writer.WriteEndObject(); |
| 72 | 49 | | } |
| | 50 | |
|
| | 51 | | internal static Sku DeserializeSku(JsonElement element) |
| | 52 | | { |
| 144 | 53 | | string name = default; |
| 144 | 54 | | string tier = default; |
| 144 | 55 | | string size = default; |
| 144 | 56 | | string family = default; |
| 144 | 57 | | string model = default; |
| 144 | 58 | | int? capacity = default; |
| 1208 | 59 | | foreach (var property in element.EnumerateObject()) |
| | 60 | | { |
| 460 | 61 | | if (property.NameEquals("name")) |
| | 62 | | { |
| 144 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 144 | 67 | | name = property.Value.GetString(); |
| 144 | 68 | | continue; |
| | 69 | | } |
| 316 | 70 | | if (property.NameEquals("tier")) |
| | 71 | | { |
| 120 | 72 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| | 74 | | continue; |
| | 75 | | } |
| 120 | 76 | | tier = property.Value.GetString(); |
| 120 | 77 | | continue; |
| | 78 | | } |
| 196 | 79 | | if (property.NameEquals("size")) |
| | 80 | | { |
| 64 | 81 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| | 83 | | continue; |
| | 84 | | } |
| 64 | 85 | | size = property.Value.GetString(); |
| 64 | 86 | | continue; |
| | 87 | | } |
| 132 | 88 | | if (property.NameEquals("family")) |
| | 89 | | { |
| 64 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 64 | 94 | | family = property.Value.GetString(); |
| 64 | 95 | | continue; |
| | 96 | | } |
| 68 | 97 | | if (property.NameEquals("model")) |
| | 98 | | { |
| 0 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | model = property.Value.GetString(); |
| 0 | 104 | | continue; |
| | 105 | | } |
| 68 | 106 | | if (property.NameEquals("capacity")) |
| | 107 | | { |
| 68 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 68 | 112 | | capacity = property.Value.GetInt32(); |
| | 113 | | continue; |
| | 114 | | } |
| | 115 | | } |
| 144 | 116 | | return new Sku(name, tier, size, family, model, capacity); |
| | 117 | | } |
| | 118 | | } |
| | 119 | | } |