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