| | 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 DelimitedTextDataset : 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.IsDefined(Structure)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("structure"); |
| 0 | 29 | | writer.WriteObjectValue(Structure); |
| | 30 | | } |
| 0 | 31 | | if (Optional.IsDefined(Schema)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("schema"); |
| 0 | 34 | | writer.WriteObjectValue(Schema); |
| | 35 | | } |
| 0 | 36 | | writer.WritePropertyName("linkedServiceName"); |
| 0 | 37 | | writer.WriteObjectValue(LinkedServiceName); |
| 0 | 38 | | if (Optional.IsCollectionDefined(Parameters)) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("parameters"); |
| 0 | 41 | | writer.WriteStartObject(); |
| 0 | 42 | | foreach (var item in Parameters) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName(item.Key); |
| 0 | 45 | | writer.WriteObjectValue(item.Value); |
| | 46 | | } |
| 0 | 47 | | writer.WriteEndObject(); |
| | 48 | | } |
| 0 | 49 | | if (Optional.IsCollectionDefined(Annotations)) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("annotations"); |
| 0 | 52 | | writer.WriteStartArray(); |
| 0 | 53 | | foreach (var item in Annotations) |
| | 54 | | { |
| 0 | 55 | | writer.WriteObjectValue(item); |
| | 56 | | } |
| 0 | 57 | | writer.WriteEndArray(); |
| | 58 | | } |
| 0 | 59 | | if (Optional.IsDefined(Folder)) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("folder"); |
| 0 | 62 | | writer.WriteObjectValue(Folder); |
| | 63 | | } |
| 0 | 64 | | writer.WritePropertyName("typeProperties"); |
| 0 | 65 | | writer.WriteStartObject(); |
| 0 | 66 | | if (Optional.IsDefined(Location)) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("location"); |
| 0 | 69 | | writer.WriteObjectValue(Location); |
| | 70 | | } |
| 0 | 71 | | if (Optional.IsDefined(ColumnDelimiter)) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("columnDelimiter"); |
| 0 | 74 | | writer.WriteObjectValue(ColumnDelimiter); |
| | 75 | | } |
| 0 | 76 | | if (Optional.IsDefined(RowDelimiter)) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("rowDelimiter"); |
| 0 | 79 | | writer.WriteObjectValue(RowDelimiter); |
| | 80 | | } |
| 0 | 81 | | if (Optional.IsDefined(EncodingName)) |
| | 82 | | { |
| 0 | 83 | | writer.WritePropertyName("encodingName"); |
| 0 | 84 | | writer.WriteObjectValue(EncodingName); |
| | 85 | | } |
| 0 | 86 | | if (Optional.IsDefined(CompressionCodec)) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("compressionCodec"); |
| 0 | 89 | | writer.WriteStringValue(CompressionCodec.Value.ToString()); |
| | 90 | | } |
| 0 | 91 | | if (Optional.IsDefined(CompressionLevel)) |
| | 92 | | { |
| 0 | 93 | | writer.WritePropertyName("compressionLevel"); |
| 0 | 94 | | writer.WriteStringValue(CompressionLevel.Value.ToString()); |
| | 95 | | } |
| 0 | 96 | | if (Optional.IsDefined(QuoteChar)) |
| | 97 | | { |
| 0 | 98 | | writer.WritePropertyName("quoteChar"); |
| 0 | 99 | | writer.WriteObjectValue(QuoteChar); |
| | 100 | | } |
| 0 | 101 | | if (Optional.IsDefined(EscapeChar)) |
| | 102 | | { |
| 0 | 103 | | writer.WritePropertyName("escapeChar"); |
| 0 | 104 | | writer.WriteObjectValue(EscapeChar); |
| | 105 | | } |
| 0 | 106 | | if (Optional.IsDefined(FirstRowAsHeader)) |
| | 107 | | { |
| 0 | 108 | | writer.WritePropertyName("firstRowAsHeader"); |
| 0 | 109 | | writer.WriteObjectValue(FirstRowAsHeader); |
| | 110 | | } |
| 0 | 111 | | if (Optional.IsDefined(NullValue)) |
| | 112 | | { |
| 0 | 113 | | writer.WritePropertyName("nullValue"); |
| 0 | 114 | | writer.WriteObjectValue(NullValue); |
| | 115 | | } |
| 0 | 116 | | writer.WriteEndObject(); |
| 0 | 117 | | foreach (var item in AdditionalProperties) |
| | 118 | | { |
| 0 | 119 | | writer.WritePropertyName(item.Key); |
| 0 | 120 | | writer.WriteObjectValue(item.Value); |
| | 121 | | } |
| 0 | 122 | | writer.WriteEndObject(); |
| 0 | 123 | | } |
| | 124 | |
|
| | 125 | | internal static DelimitedTextDataset DeserializeDelimitedTextDataset(JsonElement element) |
| | 126 | | { |
| 0 | 127 | | string type = default; |
| 0 | 128 | | Optional<string> description = default; |
| 0 | 129 | | Optional<object> structure = default; |
| 0 | 130 | | Optional<object> schema = default; |
| 0 | 131 | | LinkedServiceReference linkedServiceName = default; |
| 0 | 132 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 133 | | Optional<IList<object>> annotations = default; |
| 0 | 134 | | Optional<DatasetFolder> folder = default; |
| 0 | 135 | | Optional<DatasetLocation> location = default; |
| 0 | 136 | | Optional<object> columnDelimiter = default; |
| 0 | 137 | | Optional<object> rowDelimiter = default; |
| 0 | 138 | | Optional<object> encodingName = default; |
| 0 | 139 | | Optional<DelimitedTextCompressionCodec> compressionCodec = default; |
| 0 | 140 | | Optional<DatasetCompressionLevel> compressionLevel = default; |
| 0 | 141 | | Optional<object> quoteChar = default; |
| 0 | 142 | | Optional<object> escapeChar = default; |
| 0 | 143 | | Optional<object> firstRowAsHeader = default; |
| 0 | 144 | | Optional<object> nullValue = default; |
| 0 | 145 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 146 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 147 | | foreach (var property in element.EnumerateObject()) |
| | 148 | | { |
| 0 | 149 | | if (property.NameEquals("type")) |
| | 150 | | { |
| 0 | 151 | | type = property.Value.GetString(); |
| 0 | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | if (property.NameEquals("description")) |
| | 155 | | { |
| 0 | 156 | | description = property.Value.GetString(); |
| 0 | 157 | | continue; |
| | 158 | | } |
| 0 | 159 | | if (property.NameEquals("structure")) |
| | 160 | | { |
| 0 | 161 | | structure = property.Value.GetObject(); |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property.NameEquals("schema")) |
| | 165 | | { |
| 0 | 166 | | schema = property.Value.GetObject(); |
| 0 | 167 | | continue; |
| | 168 | | } |
| 0 | 169 | | if (property.NameEquals("linkedServiceName")) |
| | 170 | | { |
| 0 | 171 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | if (property.NameEquals("parameters")) |
| | 175 | | { |
| 0 | 176 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 177 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 178 | | { |
| 0 | 179 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 180 | | } |
| 0 | 181 | | parameters = dictionary; |
| 0 | 182 | | continue; |
| | 183 | | } |
| 0 | 184 | | if (property.NameEquals("annotations")) |
| | 185 | | { |
| 0 | 186 | | List<object> array = new List<object>(); |
| 0 | 187 | | foreach (var item in property.Value.EnumerateArray()) |
| | 188 | | { |
| 0 | 189 | | array.Add(item.GetObject()); |
| | 190 | | } |
| 0 | 191 | | annotations = array; |
| 0 | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | if (property.NameEquals("folder")) |
| | 195 | | { |
| 0 | 196 | | folder = DatasetFolder.DeserializeDatasetFolder(property.Value); |
| 0 | 197 | | continue; |
| | 198 | | } |
| 0 | 199 | | if (property.NameEquals("typeProperties")) |
| | 200 | | { |
| 0 | 201 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 202 | | { |
| 0 | 203 | | if (property0.NameEquals("location")) |
| | 204 | | { |
| 0 | 205 | | location = DatasetLocation.DeserializeDatasetLocation(property0.Value); |
| 0 | 206 | | continue; |
| | 207 | | } |
| 0 | 208 | | if (property0.NameEquals("columnDelimiter")) |
| | 209 | | { |
| 0 | 210 | | columnDelimiter = property0.Value.GetObject(); |
| 0 | 211 | | continue; |
| | 212 | | } |
| 0 | 213 | | if (property0.NameEquals("rowDelimiter")) |
| | 214 | | { |
| 0 | 215 | | rowDelimiter = property0.Value.GetObject(); |
| 0 | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | if (property0.NameEquals("encodingName")) |
| | 219 | | { |
| 0 | 220 | | encodingName = property0.Value.GetObject(); |
| 0 | 221 | | continue; |
| | 222 | | } |
| 0 | 223 | | if (property0.NameEquals("compressionCodec")) |
| | 224 | | { |
| 0 | 225 | | compressionCodec = new DelimitedTextCompressionCodec(property0.Value.GetString()); |
| 0 | 226 | | continue; |
| | 227 | | } |
| 0 | 228 | | if (property0.NameEquals("compressionLevel")) |
| | 229 | | { |
| 0 | 230 | | compressionLevel = new DatasetCompressionLevel(property0.Value.GetString()); |
| 0 | 231 | | continue; |
| | 232 | | } |
| 0 | 233 | | if (property0.NameEquals("quoteChar")) |
| | 234 | | { |
| 0 | 235 | | quoteChar = property0.Value.GetObject(); |
| 0 | 236 | | continue; |
| | 237 | | } |
| 0 | 238 | | if (property0.NameEquals("escapeChar")) |
| | 239 | | { |
| 0 | 240 | | escapeChar = property0.Value.GetObject(); |
| 0 | 241 | | continue; |
| | 242 | | } |
| 0 | 243 | | if (property0.NameEquals("firstRowAsHeader")) |
| | 244 | | { |
| 0 | 245 | | firstRowAsHeader = property0.Value.GetObject(); |
| 0 | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | if (property0.NameEquals("nullValue")) |
| | 249 | | { |
| 0 | 250 | | nullValue = property0.Value.GetObject(); |
| | 251 | | continue; |
| | 252 | | } |
| | 253 | | } |
| | 254 | | continue; |
| | 255 | | } |
| 0 | 256 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 257 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 258 | | } |
| 0 | 259 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 260 | | return new DelimitedTextDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, O |
| | 261 | | } |
| | 262 | | } |
| | 263 | | } |