| | 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 Plan : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 8 | 17 | | writer.WriteStartObject(); |
| 8 | 18 | | if (Name != null) |
| | 19 | | { |
| 8 | 20 | | writer.WritePropertyName("name"); |
| 8 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 8 | 23 | | if (Publisher != null) |
| | 24 | | { |
| 8 | 25 | | writer.WritePropertyName("publisher"); |
| 8 | 26 | | writer.WriteStringValue(Publisher); |
| | 27 | | } |
| 8 | 28 | | if (Product != null) |
| | 29 | | { |
| 8 | 30 | | writer.WritePropertyName("product"); |
| 8 | 31 | | writer.WriteStringValue(Product); |
| | 32 | | } |
| 8 | 33 | | if (PromotionCode != null) |
| | 34 | | { |
| 8 | 35 | | writer.WritePropertyName("promotionCode"); |
| 8 | 36 | | writer.WriteStringValue(PromotionCode); |
| | 37 | | } |
| 8 | 38 | | if (Version != null) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("version"); |
| 0 | 41 | | writer.WriteStringValue(Version); |
| | 42 | | } |
| 8 | 43 | | writer.WriteEndObject(); |
| 8 | 44 | | } |
| | 45 | |
|
| | 46 | | internal static Plan DeserializePlan(JsonElement element) |
| | 47 | | { |
| 10 | 48 | | string name = default; |
| 10 | 49 | | string publisher = default; |
| 10 | 50 | | string product = default; |
| 10 | 51 | | string promotionCode = default; |
| 10 | 52 | | string version = default; |
| 100 | 53 | | foreach (var property in element.EnumerateObject()) |
| | 54 | | { |
| 40 | 55 | | if (property.NameEquals("name")) |
| | 56 | | { |
| 10 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 58 | | { |
| | 59 | | continue; |
| | 60 | | } |
| 10 | 61 | | name = property.Value.GetString(); |
| 10 | 62 | | continue; |
| | 63 | | } |
| 30 | 64 | | if (property.NameEquals("publisher")) |
| | 65 | | { |
| 10 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 10 | 70 | | publisher = property.Value.GetString(); |
| 10 | 71 | | continue; |
| | 72 | | } |
| 20 | 73 | | if (property.NameEquals("product")) |
| | 74 | | { |
| 10 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 76 | | { |
| | 77 | | continue; |
| | 78 | | } |
| 10 | 79 | | product = property.Value.GetString(); |
| 10 | 80 | | continue; |
| | 81 | | } |
| 10 | 82 | | if (property.NameEquals("promotionCode")) |
| | 83 | | { |
| 10 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 10 | 88 | | promotionCode = property.Value.GetString(); |
| 10 | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | if (property.NameEquals("version")) |
| | 92 | | { |
| 0 | 93 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | version = property.Value.GetString(); |
| | 98 | | continue; |
| | 99 | | } |
| | 100 | | } |
| 10 | 101 | | return new Plan(name, publisher, product, promotionCode, version); |
| | 102 | | } |
| | 103 | | } |
| | 104 | | } |