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