| | 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.Analytics.Synapse.Artifacts; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.Analytics.Synapse.Artifacts.Models |
| | 14 | | { |
| | 15 | | public partial class LinkedServiceReference : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | writer.WritePropertyName("type"); |
| 0 | 21 | | writer.WriteStringValue(Type.ToString()); |
| 0 | 22 | | writer.WritePropertyName("referenceName"); |
| 0 | 23 | | writer.WriteStringValue(ReferenceName); |
| 0 | 24 | | if (Optional.IsCollectionDefined(Parameters)) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("parameters"); |
| 0 | 27 | | writer.WriteStartObject(); |
| 0 | 28 | | foreach (var item in Parameters) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName(item.Key); |
| 0 | 31 | | writer.WriteObjectValue(item.Value); |
| | 32 | | } |
| 0 | 33 | | writer.WriteEndObject(); |
| | 34 | | } |
| 0 | 35 | | writer.WriteEndObject(); |
| 0 | 36 | | } |
| | 37 | |
|
| | 38 | | internal static LinkedServiceReference DeserializeLinkedServiceReference(JsonElement element) |
| | 39 | | { |
| 0 | 40 | | LinkedServiceReferenceType type = default; |
| 0 | 41 | | string referenceName = default; |
| 0 | 42 | | Optional<IDictionary<string, object>> parameters = default; |
| 0 | 43 | | foreach (var property in element.EnumerateObject()) |
| | 44 | | { |
| 0 | 45 | | if (property.NameEquals("type")) |
| | 46 | | { |
| 0 | 47 | | type = new LinkedServiceReferenceType(property.Value.GetString()); |
| 0 | 48 | | continue; |
| | 49 | | } |
| 0 | 50 | | if (property.NameEquals("referenceName")) |
| | 51 | | { |
| 0 | 52 | | referenceName = property.Value.GetString(); |
| 0 | 53 | | continue; |
| | 54 | | } |
| 0 | 55 | | if (property.NameEquals("parameters")) |
| | 56 | | { |
| 0 | 57 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 58 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 59 | | { |
| 0 | 60 | | dictionary.Add(property0.Name, property0.Value.GetObject()); |
| | 61 | | } |
| 0 | 62 | | parameters = dictionary; |
| | 63 | | continue; |
| | 64 | | } |
| | 65 | | } |
| 0 | 66 | | return new LinkedServiceReference(type, referenceName, Optional.ToDictionary(parameters)); |
| | 67 | | } |
| | 68 | | } |
| | 69 | | } |