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