| | 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 CustomDataSourceLinkedService : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("typeProperties"); |
| 0 | 20 | | writer.WriteObjectValue(TypeProperties); |
| 0 | 21 | | writer.WritePropertyName("type"); |
| 0 | 22 | | writer.WriteStringValue(Type); |
| 0 | 23 | | if (Optional.IsDefined(ConnectVia)) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("connectVia"); |
| 0 | 26 | | writer.WriteObjectValue(ConnectVia); |
| | 27 | | } |
| 0 | 28 | | if (Optional.IsDefined(Description)) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("description"); |
| 0 | 31 | | writer.WriteStringValue(Description); |
| | 32 | | } |
| 0 | 33 | | if (Optional.IsCollectionDefined(Parameters)) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName("parameters"); |
| 0 | 36 | | writer.WriteStartObject(); |
| 0 | 37 | | foreach (var item in Parameters) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName(item.Key); |
| 0 | 40 | | writer.WriteObjectValue(item.Value); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndObject(); |
| | 43 | | } |
| 0 | 44 | | if (Optional.IsCollectionDefined(Annotations)) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("annotations"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in Annotations) |
| | 49 | | { |
| 0 | 50 | | writer.WriteObjectValue(item); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | foreach (var item in AdditionalProperties) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName(item.Key); |
| 0 | 57 | | writer.WriteObjectValue(item.Value); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndObject(); |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | internal static CustomDataSourceLinkedService DeserializeCustomDataSourceLinkedService(JsonElement element) |
| | 63 | | { |
| 0 | 64 | | object typeProperties = default; |
| 0 | 65 | | string type = default; |
| 0 | 66 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 67 | | Optional<string> description = default; |
| 0 | 68 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 69 | | Optional<IList<object>> annotations = default; |
| 0 | 70 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 71 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 72 | | foreach (var property in element.EnumerateObject()) |
| | 73 | | { |
| 0 | 74 | | if (property.NameEquals("typeProperties")) |
| | 75 | | { |
| 0 | 76 | | typeProperties = property.Value.GetObject(); |
| 0 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("type")) |
| | 80 | | { |
| 0 | 81 | | type = property.Value.GetString(); |
| 0 | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | if (property.NameEquals("connectVia")) |
| | 85 | | { |
| 0 | 86 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); |
| 0 | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | if (property.NameEquals("description")) |
| | 90 | | { |
| 0 | 91 | | description = property.Value.GetString(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("parameters")) |
| | 95 | | { |
| 0 | 96 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 97 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 98 | | { |
| 0 | 99 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 100 | | } |
| 0 | 101 | | parameters = dictionary; |
| 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 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 115 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 116 | | } |
| 0 | 117 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 118 | | return new CustomDataSourceLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(pa |
| | 119 | | } |
| | 120 | | } |
| | 121 | | } |