| | 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.Storage.Models |
| | 12 | | { |
| | 13 | | public partial class Sku : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 624 | 17 | | writer.WriteStartObject(); |
| 624 | 18 | | writer.WritePropertyName("name"); |
| 624 | 19 | | writer.WriteStringValue(Name.ToString()); |
| 624 | 20 | | if (Tier != null) |
| | 21 | | { |
| 16 | 22 | | writer.WritePropertyName("tier"); |
| 16 | 23 | | writer.WriteStringValue(Tier.Value.ToSerialString()); |
| | 24 | | } |
| 624 | 25 | | writer.WriteEndObject(); |
| 624 | 26 | | } |
| | 27 | |
|
| | 28 | | internal static Sku DeserializeSku(JsonElement element) |
| | 29 | | { |
| 880 | 30 | | SkuName name = default; |
| 880 | 31 | | SkuTier? tier = default; |
| 5280 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 1760 | 34 | | if (property.NameEquals("name")) |
| | 35 | | { |
| 880 | 36 | | name = new SkuName(property.Value.GetString()); |
| 880 | 37 | | continue; |
| | 38 | | } |
| 880 | 39 | | if (property.NameEquals("tier")) |
| | 40 | | { |
| 880 | 41 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 42 | | { |
| | 43 | | continue; |
| | 44 | | } |
| 880 | 45 | | tier = property.Value.GetString().ToSkuTier(); |
| | 46 | | continue; |
| | 47 | | } |
| | 48 | | } |
| 880 | 49 | | return new Sku(name, tier); |
| | 50 | | } |
| | 51 | | } |
| | 52 | | } |