-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathLinkedService.Serialization.cs
249 lines (243 loc) · 17.3 KB
/
LinkedService.Serialization.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using Azure.Core;
namespace Azure.Analytics.Synapse.Artifacts.Models
{
[JsonConverter(typeof(LinkedServiceConverter))]
public partial class LinkedService : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
writer.WriteStartObject();
writer.WritePropertyName("type");
writer.WriteStringValue(Type);
if (Optional.IsDefined(ConnectVia))
{
writer.WritePropertyName("connectVia");
writer.WriteObjectValue(ConnectVia);
}
if (Optional.IsDefined(Description))
{
writer.WritePropertyName("description");
writer.WriteStringValue(Description);
}
if (Optional.IsCollectionDefined(Parameters))
{
writer.WritePropertyName("parameters");
writer.WriteStartObject();
foreach (var item in Parameters)
{
writer.WritePropertyName(item.Key);
writer.WriteObjectValue(item.Value);
}
writer.WriteEndObject();
}
if (Optional.IsCollectionDefined(Annotations))
{
writer.WritePropertyName("annotations");
writer.WriteStartArray();
foreach (var item in Annotations)
{
writer.WriteObjectValue(item);
}
writer.WriteEndArray();
}
foreach (var item in AdditionalProperties)
{
writer.WritePropertyName(item.Key);
writer.WriteObjectValue(item.Value);
}
writer.WriteEndObject();
}
internal static LinkedService DeserializeLinkedService(JsonElement element)
{
if (element.TryGetProperty("type", out JsonElement discriminator))
{
switch (discriminator.GetString())
{
case "AmazonMWS": return AmazonMWSLinkedService.DeserializeAmazonMWSLinkedService(element);
case "AmazonRdsForOracle": return AmazonRdsForOracleLinkedService.DeserializeAmazonRdsForOracleLinkedService(element);
case "AmazonRdsForSqlServer": return AmazonRdsForSqlServerLinkedService.DeserializeAmazonRdsForSqlServerLinkedService(element);
case "AmazonRedshift": return AmazonRedshiftLinkedService.DeserializeAmazonRedshiftLinkedService(element);
case "AmazonS3": return AmazonS3LinkedService.DeserializeAmazonS3LinkedService(element);
case "AzureBatch": return AzureBatchLinkedService.DeserializeAzureBatchLinkedService(element);
case "AzureBlobFS": return AzureBlobFSLinkedService.DeserializeAzureBlobFSLinkedService(element);
case "AzureBlobStorage": return AzureBlobStorageLinkedService.DeserializeAzureBlobStorageLinkedService(element);
case "AzureDataExplorer": return AzureDataExplorerLinkedService.DeserializeAzureDataExplorerLinkedService(element);
case "AzureDataLakeAnalytics": return AzureDataLakeAnalyticsLinkedService.DeserializeAzureDataLakeAnalyticsLinkedService(element);
case "AzureDataLakeStore": return AzureDataLakeStoreLinkedService.DeserializeAzureDataLakeStoreLinkedService(element);
case "AzureDatabricks": return AzureDatabricksLinkedService.DeserializeAzureDatabricksLinkedService(element);
case "AzureDatabricksDeltaLake": return AzureDatabricksDeltaLakeLinkedService.DeserializeAzureDatabricksDeltaLakeLinkedService(element);
case "AzureFileStorage": return AzureFileStorageLinkedService.DeserializeAzureFileStorageLinkedService(element);
case "AzureFunction": return AzureFunctionLinkedService.DeserializeAzureFunctionLinkedService(element);
case "AzureKeyVault": return AzureKeyVaultLinkedService.DeserializeAzureKeyVaultLinkedService(element);
case "AzureML": return AzureMLLinkedService.DeserializeAzureMLLinkedService(element);
case "AzureMLService": return AzureMLServiceLinkedService.DeserializeAzureMLServiceLinkedService(element);
case "AzureMariaDB": return AzureMariaDBLinkedService.DeserializeAzureMariaDBLinkedService(element);
case "AzureMySql": return AzureMySqlLinkedService.DeserializeAzureMySqlLinkedService(element);
case "AzurePostgreSql": return AzurePostgreSqlLinkedService.DeserializeAzurePostgreSqlLinkedService(element);
case "AzureSearch": return AzureSearchLinkedService.DeserializeAzureSearchLinkedService(element);
case "AzureSqlDW": return AzureSqlDWLinkedService.DeserializeAzureSqlDWLinkedService(element);
case "AzureSqlDatabase": return AzureSqlDatabaseLinkedService.DeserializeAzureSqlDatabaseLinkedService(element);
case "AzureSqlMI": return AzureSqlMILinkedService.DeserializeAzureSqlMILinkedService(element);
case "AzureStorage": return AzureStorageLinkedService.DeserializeAzureStorageLinkedService(element);
case "AzureTableStorage": return AzureTableStorageLinkedService.DeserializeAzureTableStorageLinkedService(element);
case "Cassandra": return CassandraLinkedService.DeserializeCassandraLinkedService(element);
case "CommonDataServiceForApps": return CommonDataServiceForAppsLinkedService.DeserializeCommonDataServiceForAppsLinkedService(element);
case "Concur": return ConcurLinkedService.DeserializeConcurLinkedService(element);
case "CosmosDb": return CosmosDbLinkedService.DeserializeCosmosDbLinkedService(element);
case "CosmosDbMongoDbApi": return CosmosDbMongoDbApiLinkedService.DeserializeCosmosDbMongoDbApiLinkedService(element);
case "Couchbase": return CouchbaseLinkedService.DeserializeCouchbaseLinkedService(element);
case "CustomDataSource": return CustomDataSourceLinkedService.DeserializeCustomDataSourceLinkedService(element);
case "Db2": return Db2LinkedService.DeserializeDb2LinkedService(element);
case "Drill": return DrillLinkedService.DeserializeDrillLinkedService(element);
case "Dynamics": return DynamicsLinkedService.DeserializeDynamicsLinkedService(element);
case "DynamicsAX": return DynamicsAXLinkedService.DeserializeDynamicsAXLinkedService(element);
case "DynamicsCrm": return DynamicsCrmLinkedService.DeserializeDynamicsCrmLinkedService(element);
case "Eloqua": return EloquaLinkedService.DeserializeEloquaLinkedService(element);
case "FileServer": return FileServerLinkedService.DeserializeFileServerLinkedService(element);
case "FtpServer": return FtpServerLinkedService.DeserializeFtpServerLinkedService(element);
case "GoogleAdWords": return GoogleAdWordsLinkedService.DeserializeGoogleAdWordsLinkedService(element);
case "GoogleBigQuery": return GoogleBigQueryLinkedService.DeserializeGoogleBigQueryLinkedService(element);
case "GoogleCloudStorage": return GoogleCloudStorageLinkedService.DeserializeGoogleCloudStorageLinkedService(element);
case "Greenplum": return GreenplumLinkedService.DeserializeGreenplumLinkedService(element);
case "HBase": return HBaseLinkedService.DeserializeHBaseLinkedService(element);
case "HDInsight": return HDInsightLinkedService.DeserializeHDInsightLinkedService(element);
case "HDInsightOnDemand": return HDInsightOnDemandLinkedService.DeserializeHDInsightOnDemandLinkedService(element);
case "Hdfs": return HdfsLinkedService.DeserializeHdfsLinkedService(element);
case "Hive": return HiveLinkedService.DeserializeHiveLinkedService(element);
case "HttpServer": return HttpLinkedService.DeserializeHttpLinkedService(element);
case "Hubspot": return HubspotLinkedService.DeserializeHubspotLinkedService(element);
case "Impala": return ImpalaLinkedService.DeserializeImpalaLinkedService(element);
case "Informix": return InformixLinkedService.DeserializeInformixLinkedService(element);
case "Jira": return JiraLinkedService.DeserializeJiraLinkedService(element);
case "Magento": return MagentoLinkedService.DeserializeMagentoLinkedService(element);
case "MariaDB": return MariaDBLinkedService.DeserializeMariaDBLinkedService(element);
case "Marketo": return MarketoLinkedService.DeserializeMarketoLinkedService(element);
case "MicrosoftAccess": return MicrosoftAccessLinkedService.DeserializeMicrosoftAccessLinkedService(element);
case "MongoDb": return MongoDbLinkedService.DeserializeMongoDbLinkedService(element);
case "MongoDbAtlas": return MongoDbAtlasLinkedService.DeserializeMongoDbAtlasLinkedService(element);
case "MongoDbV2": return MongoDbV2LinkedService.DeserializeMongoDbV2LinkedService(element);
case "MySql": return MySqlLinkedService.DeserializeMySqlLinkedService(element);
case "Netezza": return NetezzaLinkedService.DeserializeNetezzaLinkedService(element);
case "OData": return ODataLinkedService.DeserializeODataLinkedService(element);
case "Odbc": return OdbcLinkedService.DeserializeOdbcLinkedService(element);
case "Office365": return Office365LinkedService.DeserializeOffice365LinkedService(element);
case "Oracle": return OracleLinkedService.DeserializeOracleLinkedService(element);
case "OracleServiceCloud": return OracleServiceCloudLinkedService.DeserializeOracleServiceCloudLinkedService(element);
case "Paypal": return PaypalLinkedService.DeserializePaypalLinkedService(element);
case "Phoenix": return PhoenixLinkedService.DeserializePhoenixLinkedService(element);
case "PostgreSql": return PostgreSqlLinkedService.DeserializePostgreSqlLinkedService(element);
case "Presto": return PrestoLinkedService.DeserializePrestoLinkedService(element);
case "QuickBooks": return QuickBooksLinkedService.DeserializeQuickBooksLinkedService(element);
case "Responsys": return ResponsysLinkedService.DeserializeResponsysLinkedService(element);
case "RestService": return RestServiceLinkedService.DeserializeRestServiceLinkedService(element);
case "Salesforce": return SalesforceLinkedService.DeserializeSalesforceLinkedService(element);
case "SalesforceMarketingCloud": return SalesforceMarketingCloudLinkedService.DeserializeSalesforceMarketingCloudLinkedService(element);
case "SalesforceServiceCloud": return SalesforceServiceCloudLinkedService.DeserializeSalesforceServiceCloudLinkedService(element);
case "SapBW": return SapBWLinkedService.DeserializeSapBWLinkedService(element);
case "SapCloudForCustomer": return SapCloudForCustomerLinkedService.DeserializeSapCloudForCustomerLinkedService(element);
case "SapEcc": return SapEccLinkedService.DeserializeSapEccLinkedService(element);
case "SapHana": return SapHanaLinkedService.DeserializeSapHanaLinkedService(element);
case "SapOpenHub": return SapOpenHubLinkedService.DeserializeSapOpenHubLinkedService(element);
case "SapTable": return SapTableLinkedService.DeserializeSapTableLinkedService(element);
case "ServiceNow": return ServiceNowLinkedService.DeserializeServiceNowLinkedService(element);
case "Sftp": return SftpServerLinkedService.DeserializeSftpServerLinkedService(element);
case "SharePointOnlineList": return SharePointOnlineListLinkedService.DeserializeSharePointOnlineListLinkedService(element);
case "Shopify": return ShopifyLinkedService.DeserializeShopifyLinkedService(element);
case "Snowflake": return SnowflakeLinkedService.DeserializeSnowflakeLinkedService(element);
case "Spark": return SparkLinkedService.DeserializeSparkLinkedService(element);
case "SqlServer": return SqlServerLinkedService.DeserializeSqlServerLinkedService(element);
case "Square": return SquareLinkedService.DeserializeSquareLinkedService(element);
case "Sybase": return SybaseLinkedService.DeserializeSybaseLinkedService(element);
case "Teradata": return TeradataLinkedService.DeserializeTeradataLinkedService(element);
case "Vertica": return VerticaLinkedService.DeserializeVerticaLinkedService(element);
case "Web": return WebLinkedService.DeserializeWebLinkedService(element);
case "Xero": return XeroLinkedService.DeserializeXeroLinkedService(element);
case "Zoho": return ZohoLinkedService.DeserializeZohoLinkedService(element);
}
}
string type = default;
Optional<IntegrationRuntimeReference> connectVia = default;
Optional<string> description = default;
Optional<IDictionary<string, ParameterSpecification>> parameters = default;
Optional<IList<object>> annotations = default;
IDictionary<string, object> additionalProperties = default;
Dictionary<string, object> additionalPropertiesDictionary = new Dictionary<string, object>();
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("type"))
{
type = property.Value.GetString();
continue;
}
if (property.NameEquals("connectVia"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}
connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value);
continue;
}
if (property.NameEquals("description"))
{
description = property.Value.GetString();
continue;
}
if (property.NameEquals("parameters"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}
Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecification>();
foreach (var property0 in property.Value.EnumerateObject())
{
dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property0.Value));
}
parameters = dictionary;
continue;
}
if (property.NameEquals("annotations"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}
List<object> array = new List<object>();
foreach (var item in property.Value.EnumerateArray())
{
array.Add(item.GetObject());
}
annotations = array;
continue;
}
additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
}
additionalProperties = additionalPropertiesDictionary;
return new LinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties);
}
internal partial class LinkedServiceConverter : JsonConverter<LinkedService>
{
public override void Write(Utf8JsonWriter writer, LinkedService model, JsonSerializerOptions options)
{
writer.WriteObjectValue(model);
}
public override LinkedService Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
using var document = JsonDocument.ParseValue(ref reader);
return DeserializeLinkedService(document.RootElement);
}
}
}
}