| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Analytics.Synapse.Artifacts.Models |
| | 13 | | { |
| | 14 | | public partial class DataFlow : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("type"); |
| 0 | 20 | | writer.WriteStringValue(Type); |
| 0 | 21 | | if (Optional.IsDefined(Description)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("description"); |
| 0 | 24 | | writer.WriteStringValue(Description); |
| | 25 | | } |
| 0 | 26 | | if (Optional.IsCollectionDefined(Annotations)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("annotations"); |
| 0 | 29 | | writer.WriteStartArray(); |
| 0 | 30 | | foreach (var item in Annotations) |
| | 31 | | { |
| 0 | 32 | | writer.WriteObjectValue(item); |
| | 33 | | } |
| 0 | 34 | | writer.WriteEndArray(); |
| | 35 | | } |
| 0 | 36 | | if (Optional.IsDefined(Folder)) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("folder"); |
| 0 | 39 | | writer.WriteObjectValue(Folder); |
| | 40 | | } |
| 0 | 41 | | writer.WriteEndObject(); |
| 0 | 42 | | } |
| | 43 | |
|
| | 44 | | internal static DataFlow DeserializeDataFlow(JsonElement element) |
| | 45 | | { |
| 0 | 46 | | if (element.TryGetProperty("type", out JsonElement discriminator)) |
| | 47 | | { |
| 0 | 48 | | switch (discriminator.GetString()) |
| | 49 | | { |
| 0 | 50 | | case "MappingDataFlow": return MappingDataFlow.DeserializeMappingDataFlow(element); |
| | 51 | | } |
| | 52 | | } |
| 0 | 53 | | string type = default; |
| 0 | 54 | | Optional<string> description = default; |
| 0 | 55 | | Optional<IList<object>> annotations = default; |
| 0 | 56 | | Optional<DataFlowFolder> folder = default; |
| 0 | 57 | | foreach (var property in element.EnumerateObject()) |
| | 58 | | { |
| 0 | 59 | | if (property.NameEquals("type")) |
| | 60 | | { |
| 0 | 61 | | type = property.Value.GetString(); |
| 0 | 62 | | continue; |
| | 63 | | } |
| 0 | 64 | | if (property.NameEquals("description")) |
| | 65 | | { |
| 0 | 66 | | description = property.Value.GetString(); |
| 0 | 67 | | continue; |
| | 68 | | } |
| 0 | 69 | | if (property.NameEquals("annotations")) |
| | 70 | | { |
| 0 | 71 | | List<object> array = new List<object>(); |
| 0 | 72 | | foreach (var item in property.Value.EnumerateArray()) |
| | 73 | | { |
| 0 | 74 | | array.Add(item.GetObject()); |
| | 75 | | } |
| 0 | 76 | | annotations = array; |
| 0 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("folder")) |
| | 80 | | { |
| 0 | 81 | | folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value); |
| | 82 | | continue; |
| | 83 | | } |
| | 84 | | } |
| 0 | 85 | | return new DataFlow(type, description.Value, Optional.ToList(annotations), folder.Value); |
| | 86 | | } |
| | 87 | | } |
| | 88 | | } |