|   |  | 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 MongoDbLinkedService : 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("server"); | 
|   | 0 | 55 |  |             writer.WriteObjectValue(Server); | 
|   | 0 | 56 |  |             if (Optional.IsDefined(AuthenticationType)) | 
|   |  | 57 |  |             { | 
|   | 0 | 58 |  |                 writer.WritePropertyName("authenticationType"); | 
|   | 0 | 59 |  |                 writer.WriteStringValue(AuthenticationType.Value.ToString()); | 
|   |  | 60 |  |             } | 
|   | 0 | 61 |  |             writer.WritePropertyName("databaseName"); | 
|   | 0 | 62 |  |             writer.WriteObjectValue(DatabaseName); | 
|   | 0 | 63 |  |             if (Optional.IsDefined(Username)) | 
|   |  | 64 |  |             { | 
|   | 0 | 65 |  |                 writer.WritePropertyName("username"); | 
|   | 0 | 66 |  |                 writer.WriteObjectValue(Username); | 
|   |  | 67 |  |             } | 
|   | 0 | 68 |  |             if (Optional.IsDefined(Password)) | 
|   |  | 69 |  |             { | 
|   | 0 | 70 |  |                 writer.WritePropertyName("password"); | 
|   | 0 | 71 |  |                 writer.WriteObjectValue(Password); | 
|   |  | 72 |  |             } | 
|   | 0 | 73 |  |             if (Optional.IsDefined(AuthSource)) | 
|   |  | 74 |  |             { | 
|   | 0 | 75 |  |                 writer.WritePropertyName("authSource"); | 
|   | 0 | 76 |  |                 writer.WriteObjectValue(AuthSource); | 
|   |  | 77 |  |             } | 
|   | 0 | 78 |  |             if (Optional.IsDefined(Port)) | 
|   |  | 79 |  |             { | 
|   | 0 | 80 |  |                 writer.WritePropertyName("port"); | 
|   | 0 | 81 |  |                 writer.WriteObjectValue(Port); | 
|   |  | 82 |  |             } | 
|   | 0 | 83 |  |             if (Optional.IsDefined(EnableSsl)) | 
|   |  | 84 |  |             { | 
|   | 0 | 85 |  |                 writer.WritePropertyName("enableSsl"); | 
|   | 0 | 86 |  |                 writer.WriteObjectValue(EnableSsl); | 
|   |  | 87 |  |             } | 
|   | 0 | 88 |  |             if (Optional.IsDefined(AllowSelfSignedServerCert)) | 
|   |  | 89 |  |             { | 
|   | 0 | 90 |  |                 writer.WritePropertyName("allowSelfSignedServerCert"); | 
|   | 0 | 91 |  |                 writer.WriteObjectValue(AllowSelfSignedServerCert); | 
|   |  | 92 |  |             } | 
|   | 0 | 93 |  |             if (Optional.IsDefined(EncryptedCredential)) | 
|   |  | 94 |  |             { | 
|   | 0 | 95 |  |                 writer.WritePropertyName("encryptedCredential"); | 
|   | 0 | 96 |  |                 writer.WriteObjectValue(EncryptedCredential); | 
|   |  | 97 |  |             } | 
|   | 0 | 98 |  |             writer.WriteEndObject(); | 
|   | 0 | 99 |  |             foreach (var item in AdditionalProperties) | 
|   |  | 100 |  |             { | 
|   | 0 | 101 |  |                 writer.WritePropertyName(item.Key); | 
|   | 0 | 102 |  |                 writer.WriteObjectValue(item.Value); | 
|   |  | 103 |  |             } | 
|   | 0 | 104 |  |             writer.WriteEndObject(); | 
|   | 0 | 105 |  |         } | 
|   |  | 106 |  |  | 
|   |  | 107 |  |         internal static MongoDbLinkedService DeserializeMongoDbLinkedService(JsonElement element) | 
|   |  | 108 |  |         { | 
|   | 0 | 109 |  |             string type = default; | 
|   | 0 | 110 |  |             Optional<IntegrationRuntimeReference> connectVia = default; | 
|   | 0 | 111 |  |             Optional<string> description = default; | 
|   | 0 | 112 |  |             Optional<IDictionary<string, ParameterSpecification>> parameters = default; | 
|   | 0 | 113 |  |             Optional<IList<object>> annotations = default; | 
|   | 0 | 114 |  |             object server = default; | 
|   | 0 | 115 |  |             Optional<MongoDbAuthenticationType> authenticationType = default; | 
|   | 0 | 116 |  |             object databaseName = default; | 
|   | 0 | 117 |  |             Optional<object> username = default; | 
|   | 0 | 118 |  |             Optional<SecretBase> password = default; | 
|   | 0 | 119 |  |             Optional<object> authSource = default; | 
|   | 0 | 120 |  |             Optional<object> port = default; | 
|   | 0 | 121 |  |             Optional<object> enableSsl = default; | 
|   | 0 | 122 |  |             Optional<object> allowSelfSignedServerCert = default; | 
|   | 0 | 123 |  |             Optional<object> encryptedCredential = default; | 
|   | 0 | 124 |  |             IDictionary<string, object> additionalProperties = default; | 
|   | 0 | 125 |  |             Dictionary<string, object> additionalPropertiesDictionary = default; | 
|   | 0 | 126 |  |             foreach (var property in element.EnumerateObject()) | 
|   |  | 127 |  |             { | 
|   | 0 | 128 |  |                 if (property.NameEquals("type")) | 
|   |  | 129 |  |                 { | 
|   | 0 | 130 |  |                     type = property.Value.GetString(); | 
|   | 0 | 131 |  |                     continue; | 
|   |  | 132 |  |                 } | 
|   | 0 | 133 |  |                 if (property.NameEquals("connectVia")) | 
|   |  | 134 |  |                 { | 
|   | 0 | 135 |  |                     connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); | 
|   | 0 | 136 |  |                     continue; | 
|   |  | 137 |  |                 } | 
|   | 0 | 138 |  |                 if (property.NameEquals("description")) | 
|   |  | 139 |  |                 { | 
|   | 0 | 140 |  |                     description = property.Value.GetString(); | 
|   | 0 | 141 |  |                     continue; | 
|   |  | 142 |  |                 } | 
|   | 0 | 143 |  |                 if (property.NameEquals("parameters")) | 
|   |  | 144 |  |                 { | 
|   | 0 | 145 |  |                     Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio | 
|   | 0 | 146 |  |                     foreach (var property0 in property.Value.EnumerateObject()) | 
|   |  | 147 |  |                     { | 
|   | 0 | 148 |  |                         dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property | 
|   |  | 149 |  |                     } | 
|   | 0 | 150 |  |                     parameters = dictionary; | 
|   | 0 | 151 |  |                     continue; | 
|   |  | 152 |  |                 } | 
|   | 0 | 153 |  |                 if (property.NameEquals("annotations")) | 
|   |  | 154 |  |                 { | 
|   | 0 | 155 |  |                     List<object> array = new List<object>(); | 
|   | 0 | 156 |  |                     foreach (var item in property.Value.EnumerateArray()) | 
|   |  | 157 |  |                     { | 
|   | 0 | 158 |  |                         array.Add(item.GetObject()); | 
|   |  | 159 |  |                     } | 
|   | 0 | 160 |  |                     annotations = array; | 
|   | 0 | 161 |  |                     continue; | 
|   |  | 162 |  |                 } | 
|   | 0 | 163 |  |                 if (property.NameEquals("typeProperties")) | 
|   |  | 164 |  |                 { | 
|   | 0 | 165 |  |                     foreach (var property0 in property.Value.EnumerateObject()) | 
|   |  | 166 |  |                     { | 
|   | 0 | 167 |  |                         if (property0.NameEquals("server")) | 
|   |  | 168 |  |                         { | 
|   | 0 | 169 |  |                             server = property0.Value.GetObject(); | 
|   | 0 | 170 |  |                             continue; | 
|   |  | 171 |  |                         } | 
|   | 0 | 172 |  |                         if (property0.NameEquals("authenticationType")) | 
|   |  | 173 |  |                         { | 
|   | 0 | 174 |  |                             authenticationType = new MongoDbAuthenticationType(property0.Value.GetString()); | 
|   | 0 | 175 |  |                             continue; | 
|   |  | 176 |  |                         } | 
|   | 0 | 177 |  |                         if (property0.NameEquals("databaseName")) | 
|   |  | 178 |  |                         { | 
|   | 0 | 179 |  |                             databaseName = property0.Value.GetObject(); | 
|   | 0 | 180 |  |                             continue; | 
|   |  | 181 |  |                         } | 
|   | 0 | 182 |  |                         if (property0.NameEquals("username")) | 
|   |  | 183 |  |                         { | 
|   | 0 | 184 |  |                             username = property0.Value.GetObject(); | 
|   | 0 | 185 |  |                             continue; | 
|   |  | 186 |  |                         } | 
|   | 0 | 187 |  |                         if (property0.NameEquals("password")) | 
|   |  | 188 |  |                         { | 
|   | 0 | 189 |  |                             password = SecretBase.DeserializeSecretBase(property0.Value); | 
|   | 0 | 190 |  |                             continue; | 
|   |  | 191 |  |                         } | 
|   | 0 | 192 |  |                         if (property0.NameEquals("authSource")) | 
|   |  | 193 |  |                         { | 
|   | 0 | 194 |  |                             authSource = property0.Value.GetObject(); | 
|   | 0 | 195 |  |                             continue; | 
|   |  | 196 |  |                         } | 
|   | 0 | 197 |  |                         if (property0.NameEquals("port")) | 
|   |  | 198 |  |                         { | 
|   | 0 | 199 |  |                             port = property0.Value.GetObject(); | 
|   | 0 | 200 |  |                             continue; | 
|   |  | 201 |  |                         } | 
|   | 0 | 202 |  |                         if (property0.NameEquals("enableSsl")) | 
|   |  | 203 |  |                         { | 
|   | 0 | 204 |  |                             enableSsl = property0.Value.GetObject(); | 
|   | 0 | 205 |  |                             continue; | 
|   |  | 206 |  |                         } | 
|   | 0 | 207 |  |                         if (property0.NameEquals("allowSelfSignedServerCert")) | 
|   |  | 208 |  |                         { | 
|   | 0 | 209 |  |                             allowSelfSignedServerCert = property0.Value.GetObject(); | 
|   | 0 | 210 |  |                             continue; | 
|   |  | 211 |  |                         } | 
|   | 0 | 212 |  |                         if (property0.NameEquals("encryptedCredential")) | 
|   |  | 213 |  |                         { | 
|   | 0 | 214 |  |                             encryptedCredential = property0.Value.GetObject(); | 
|   |  | 215 |  |                             continue; | 
|   |  | 216 |  |                         } | 
|   |  | 217 |  |                     } | 
|   |  | 218 |  |                     continue; | 
|   |  | 219 |  |                 } | 
|   | 0 | 220 |  |                 additionalPropertiesDictionary ??= new Dictionary<string, object>(); | 
|   | 0 | 221 |  |                 additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); | 
|   |  | 222 |  |             } | 
|   | 0 | 223 |  |             additionalProperties = additionalPropertiesDictionary; | 
|   | 0 | 224 |  |             return new MongoDbLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters) | 
|   |  | 225 |  |         } | 
|   |  | 226 |  |     } | 
|   |  | 227 |  | } |