| | 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 MySqlLinkedService : 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(ConnectVia)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("connectVia"); |
| 0 | 24 | | writer.WriteObjectValue(ConnectVia); |
| | 25 | | } |
| 0 | 26 | | if (Optional.IsDefined(Description)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("description"); |
| 0 | 29 | | writer.WriteStringValue(Description); |
| | 30 | | } |
| 0 | 31 | | if (Optional.IsCollectionDefined(Parameters)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("parameters"); |
| 0 | 34 | | writer.WriteStartObject(); |
| 0 | 35 | | foreach (var item in Parameters) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName(item.Key); |
| 0 | 38 | | writer.WriteObjectValue(item.Value); |
| | 39 | | } |
| 0 | 40 | | writer.WriteEndObject(); |
| | 41 | | } |
| 0 | 42 | | if (Optional.IsCollectionDefined(Annotations)) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("annotations"); |
| 0 | 45 | | writer.WriteStartArray(); |
| 0 | 46 | | foreach (var item in Annotations) |
| | 47 | | { |
| 0 | 48 | | writer.WriteObjectValue(item); |
| | 49 | | } |
| 0 | 50 | | writer.WriteEndArray(); |
| | 51 | | } |
| 0 | 52 | | writer.WritePropertyName("typeProperties"); |
| 0 | 53 | | writer.WriteStartObject(); |
| 0 | 54 | | writer.WritePropertyName("connectionString"); |
| 0 | 55 | | writer.WriteObjectValue(ConnectionString); |
| 0 | 56 | | if (Optional.IsDefined(Password)) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("password"); |
| 0 | 59 | | writer.WriteObjectValue(Password); |
| | 60 | | } |
| 0 | 61 | | if (Optional.IsDefined(EncryptedCredential)) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("encryptedCredential"); |
| 0 | 64 | | writer.WriteObjectValue(EncryptedCredential); |
| | 65 | | } |
| 0 | 66 | | writer.WriteEndObject(); |
| 0 | 67 | | foreach (var item in AdditionalProperties) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName(item.Key); |
| 0 | 70 | | writer.WriteObjectValue(item.Value); |
| | 71 | | } |
| 0 | 72 | | writer.WriteEndObject(); |
| 0 | 73 | | } |
| | 74 | |
|
| | 75 | | internal static MySqlLinkedService DeserializeMySqlLinkedService(JsonElement element) |
| | 76 | | { |
| 0 | 77 | | string type = default; |
| 0 | 78 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 79 | | Optional<string> description = default; |
| 0 | 80 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 81 | | Optional<IList<object>> annotations = default; |
| 0 | 82 | | object connectionString = default; |
| 0 | 83 | | Optional<AzureKeyVaultSecretReference> password = default; |
| 0 | 84 | | Optional<object> encryptedCredential = default; |
| 0 | 85 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 86 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 87 | | foreach (var property in element.EnumerateObject()) |
| | 88 | | { |
| 0 | 89 | | if (property.NameEquals("type")) |
| | 90 | | { |
| 0 | 91 | | type = property.Value.GetString(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("connectVia")) |
| | 95 | | { |
| 0 | 96 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); |
| 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("parameters")) |
| | 105 | | { |
| 0 | 106 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 107 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 108 | | { |
| 0 | 109 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 110 | | } |
| 0 | 111 | | parameters = dictionary; |
| 0 | 112 | | continue; |
| | 113 | | } |
| 0 | 114 | | if (property.NameEquals("annotations")) |
| | 115 | | { |
| 0 | 116 | | List<object> array = new List<object>(); |
| 0 | 117 | | foreach (var item in property.Value.EnumerateArray()) |
| | 118 | | { |
| 0 | 119 | | array.Add(item.GetObject()); |
| | 120 | | } |
| 0 | 121 | | annotations = array; |
| 0 | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | if (property.NameEquals("typeProperties")) |
| | 125 | | { |
| 0 | 126 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 127 | | { |
| 0 | 128 | | if (property0.NameEquals("connectionString")) |
| | 129 | | { |
| 0 | 130 | | connectionString = property0.Value.GetObject(); |
| 0 | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | if (property0.NameEquals("password")) |
| | 134 | | { |
| 0 | 135 | | password = AzureKeyVaultSecretReference.DeserializeAzureKeyVaultSecretReference(property0.Va |
| 0 | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | if (property0.NameEquals("encryptedCredential")) |
| | 139 | | { |
| 0 | 140 | | encryptedCredential = property0.Value.GetObject(); |
| | 141 | | continue; |
| | 142 | | } |
| | 143 | | } |
| | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 147 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 148 | | } |
| 0 | 149 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 150 | | return new MySqlLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), |
| | 151 | | } |
| | 152 | | } |
| | 153 | | } |