| | 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 ResourceLinkProperties : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 4 | 17 | | writer.WriteStartObject(); |
| 4 | 18 | | if (SourceId != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("sourceId"); |
| 0 | 21 | | writer.WriteStringValue(SourceId); |
| | 22 | | } |
| 4 | 23 | | writer.WritePropertyName("targetId"); |
| 4 | 24 | | writer.WriteStringValue(TargetId); |
| 4 | 25 | | if (Notes != null) |
| | 26 | | { |
| 4 | 27 | | writer.WritePropertyName("notes"); |
| 4 | 28 | | writer.WriteStringValue(Notes); |
| | 29 | | } |
| 4 | 30 | | writer.WriteEndObject(); |
| 4 | 31 | | } |
| | 32 | |
|
| | 33 | | internal static ResourceLinkProperties DeserializeResourceLinkProperties(JsonElement element) |
| | 34 | | { |
| 24 | 35 | | string sourceId = default; |
| 24 | 36 | | string targetId = default; |
| 24 | 37 | | string notes = default; |
| 192 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 72 | 40 | | if (property.NameEquals("sourceId")) |
| | 41 | | { |
| 24 | 42 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 43 | | { |
| | 44 | | continue; |
| | 45 | | } |
| 24 | 46 | | sourceId = property.Value.GetString(); |
| 24 | 47 | | continue; |
| | 48 | | } |
| 48 | 49 | | if (property.NameEquals("targetId")) |
| | 50 | | { |
| 24 | 51 | | targetId = property.Value.GetString(); |
| 24 | 52 | | continue; |
| | 53 | | } |
| 24 | 54 | | if (property.NameEquals("notes")) |
| | 55 | | { |
| 24 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 24 | 60 | | notes = property.Value.GetString(); |
| | 61 | | continue; |
| | 62 | | } |
| | 63 | | } |
| 24 | 64 | | return new ResourceLinkProperties(sourceId, targetId, notes); |
| | 65 | | } |
| | 66 | | } |
| | 67 | | } |