| | 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 PurchasePlan : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("publisher"); |
| 0 | 19 | | writer.WriteStringValue(Publisher); |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| 0 | 22 | | writer.WritePropertyName("product"); |
| 0 | 23 | | writer.WriteStringValue(Product); |
| 0 | 24 | | writer.WriteEndObject(); |
| 0 | 25 | | } |
| | 26 | |
|
| | 27 | | internal static PurchasePlan DeserializePurchasePlan(JsonElement element) |
| | 28 | | { |
| 8 | 29 | | string publisher = default; |
| 8 | 30 | | string name = default; |
| 8 | 31 | | string product = default; |
| 64 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 24 | 34 | | if (property.NameEquals("publisher")) |
| | 35 | | { |
| 8 | 36 | | publisher = property.Value.GetString(); |
| 8 | 37 | | continue; |
| | 38 | | } |
| 16 | 39 | | if (property.NameEquals("name")) |
| | 40 | | { |
| 8 | 41 | | name = property.Value.GetString(); |
| 8 | 42 | | continue; |
| | 43 | | } |
| 8 | 44 | | if (property.NameEquals("product")) |
| | 45 | | { |
| 8 | 46 | | product = property.Value.GetString(); |
| | 47 | | continue; |
| | 48 | | } |
| | 49 | | } |
| 8 | 50 | | return new PurchasePlan(publisher, name, product); |
| | 51 | | } |
| | 52 | | } |
| | 53 | | } |