| | 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 MappingDataFlow : 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.WritePropertyName("typeProperties"); |
| 0 | 42 | | writer.WriteStartObject(); |
| 0 | 43 | | if (Optional.IsCollectionDefined(Sources)) |
| | 44 | | { |
| 0 | 45 | | writer.WritePropertyName("sources"); |
| 0 | 46 | | writer.WriteStartArray(); |
| 0 | 47 | | foreach (var item in Sources) |
| | 48 | | { |
| 0 | 49 | | writer.WriteObjectValue(item); |
| | 50 | | } |
| 0 | 51 | | writer.WriteEndArray(); |
| | 52 | | } |
| 0 | 53 | | if (Optional.IsCollectionDefined(Sinks)) |
| | 54 | | { |
| 0 | 55 | | writer.WritePropertyName("sinks"); |
| 0 | 56 | | writer.WriteStartArray(); |
| 0 | 57 | | foreach (var item in Sinks) |
| | 58 | | { |
| 0 | 59 | | writer.WriteObjectValue(item); |
| | 60 | | } |
| 0 | 61 | | writer.WriteEndArray(); |
| | 62 | | } |
| 0 | 63 | | if (Optional.IsCollectionDefined(Transformations)) |
| | 64 | | { |
| 0 | 65 | | writer.WritePropertyName("transformations"); |
| 0 | 66 | | writer.WriteStartArray(); |
| 0 | 67 | | foreach (var item in Transformations) |
| | 68 | | { |
| 0 | 69 | | writer.WriteObjectValue(item); |
| | 70 | | } |
| 0 | 71 | | writer.WriteEndArray(); |
| | 72 | | } |
| 0 | 73 | | if (Optional.IsDefined(Script)) |
| | 74 | | { |
| 0 | 75 | | writer.WritePropertyName("script"); |
| 0 | 76 | | writer.WriteStringValue(Script); |
| | 77 | | } |
| 0 | 78 | | writer.WriteEndObject(); |
| 0 | 79 | | writer.WriteEndObject(); |
| 0 | 80 | | } |
| | 81 | |
|
| | 82 | | internal static MappingDataFlow DeserializeMappingDataFlow(JsonElement element) |
| | 83 | | { |
| 0 | 84 | | string type = default; |
| 0 | 85 | | Optional<string> description = default; |
| 0 | 86 | | Optional<IList<object>> annotations = default; |
| 0 | 87 | | Optional<DataFlowFolder> folder = default; |
| 0 | 88 | | Optional<IList<DataFlowSource>> sources = default; |
| 0 | 89 | | Optional<IList<DataFlowSink>> sinks = default; |
| 0 | 90 | | Optional<IList<Transformation>> transformations = default; |
| 0 | 91 | | Optional<string> script = default; |
| 0 | 92 | | foreach (var property in element.EnumerateObject()) |
| | 93 | | { |
| 0 | 94 | | if (property.NameEquals("type")) |
| | 95 | | { |
| 0 | 96 | | type = property.Value.GetString(); |
| 0 | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | if (property.NameEquals("description")) |
| | 100 | | { |
| 0 | 101 | | description = property.Value.GetString(); |
| 0 | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | if (property.NameEquals("annotations")) |
| | 105 | | { |
| 0 | 106 | | List<object> array = new List<object>(); |
| 0 | 107 | | foreach (var item in property.Value.EnumerateArray()) |
| | 108 | | { |
| 0 | 109 | | array.Add(item.GetObject()); |
| | 110 | | } |
| 0 | 111 | | annotations = array; |
| 0 | 112 | | continue; |
| | 113 | | } |
| 0 | 114 | | if (property.NameEquals("folder")) |
| | 115 | | { |
| 0 | 116 | | folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value); |
| 0 | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | if (property.NameEquals("typeProperties")) |
| | 120 | | { |
| 0 | 121 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 122 | | { |
| 0 | 123 | | if (property0.NameEquals("sources")) |
| | 124 | | { |
| 0 | 125 | | List<DataFlowSource> array = new List<DataFlowSource>(); |
| 0 | 126 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 127 | | { |
| 0 | 128 | | array.Add(DataFlowSource.DeserializeDataFlowSource(item)); |
| | 129 | | } |
| 0 | 130 | | sources = array; |
| 0 | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | if (property0.NameEquals("sinks")) |
| | 134 | | { |
| 0 | 135 | | List<DataFlowSink> array = new List<DataFlowSink>(); |
| 0 | 136 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 137 | | { |
| 0 | 138 | | array.Add(DataFlowSink.DeserializeDataFlowSink(item)); |
| | 139 | | } |
| 0 | 140 | | sinks = array; |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property0.NameEquals("transformations")) |
| | 144 | | { |
| 0 | 145 | | List<Transformation> array = new List<Transformation>(); |
| 0 | 146 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 147 | | { |
| 0 | 148 | | array.Add(Transformation.DeserializeTransformation(item)); |
| | 149 | | } |
| 0 | 150 | | transformations = array; |
| 0 | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | if (property0.NameEquals("script")) |
| | 154 | | { |
| 0 | 155 | | script = property0.Value.GetString(); |
| | 156 | | continue; |
| | 157 | | } |
| | 158 | | } |
| | 159 | | continue; |
| | 160 | | } |
| | 161 | | } |
| 0 | 162 | | return new MappingDataFlow(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToL |
| | 163 | | } |
| | 164 | | } |
| | 165 | | } |