| | 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 TemplateLink : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 88 | 17 | | writer.WriteStartObject(); |
| 88 | 18 | | writer.WritePropertyName("uri"); |
| 88 | 19 | | writer.WriteStringValue(Uri); |
| 88 | 20 | | if (ContentVersion != null) |
| | 21 | | { |
| 56 | 22 | | writer.WritePropertyName("contentVersion"); |
| 56 | 23 | | writer.WriteStringValue(ContentVersion); |
| | 24 | | } |
| 88 | 25 | | writer.WriteEndObject(); |
| 88 | 26 | | } |
| | 27 | |
|
| | 28 | | internal static TemplateLink DeserializeTemplateLink(JsonElement element) |
| | 29 | | { |
| 40 | 30 | | string uri = default; |
| 40 | 31 | | string contentVersion = default; |
| 288 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 104 | 34 | | if (property.NameEquals("uri")) |
| | 35 | | { |
| 40 | 36 | | uri = property.Value.GetString(); |
| 40 | 37 | | continue; |
| | 38 | | } |
| 64 | 39 | | if (property.NameEquals("contentVersion")) |
| | 40 | | { |
| 40 | 41 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 42 | | { |
| | 43 | | continue; |
| | 44 | | } |
| 40 | 45 | | contentVersion = property.Value.GetString(); |
| | 46 | | continue; |
| | 47 | | } |
| | 48 | | } |
| 40 | 49 | | return new TemplateLink(uri, contentVersion); |
| | 50 | | } |
| | 51 | | } |
| | 52 | | } |