| | 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 SalesforceLinkedService : 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 | | if (Optional.IsDefined(EnvironmentUrl)) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("environmentUrl"); |
| 0 | 57 | | writer.WriteObjectValue(EnvironmentUrl); |
| | 58 | | } |
| 0 | 59 | | if (Optional.IsDefined(Username)) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("username"); |
| 0 | 62 | | writer.WriteObjectValue(Username); |
| | 63 | | } |
| 0 | 64 | | if (Optional.IsDefined(Password)) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("password"); |
| 0 | 67 | | writer.WriteObjectValue(Password); |
| | 68 | | } |
| 0 | 69 | | if (Optional.IsDefined(SecurityToken)) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("securityToken"); |
| 0 | 72 | | writer.WriteObjectValue(SecurityToken); |
| | 73 | | } |
| 0 | 74 | | if (Optional.IsDefined(EncryptedCredential)) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("encryptedCredential"); |
| 0 | 77 | | writer.WriteObjectValue(EncryptedCredential); |
| | 78 | | } |
| 0 | 79 | | writer.WriteEndObject(); |
| 0 | 80 | | foreach (var item in AdditionalProperties) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName(item.Key); |
| 0 | 83 | | writer.WriteObjectValue(item.Value); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndObject(); |
| 0 | 86 | | } |
| | 87 | |
|
| | 88 | | internal static SalesforceLinkedService DeserializeSalesforceLinkedService(JsonElement element) |
| | 89 | | { |
| 0 | 90 | | string type = default; |
| 0 | 91 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 92 | | Optional<string> description = default; |
| 0 | 93 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 94 | | Optional<IList<object>> annotations = default; |
| 0 | 95 | | Optional<object> environmentUrl = default; |
| 0 | 96 | | Optional<object> username = default; |
| 0 | 97 | | Optional<SecretBase> password = default; |
| 0 | 98 | | Optional<SecretBase> securityToken = default; |
| 0 | 99 | | Optional<object> encryptedCredential = default; |
| 0 | 100 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 101 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 102 | | foreach (var property in element.EnumerateObject()) |
| | 103 | | { |
| 0 | 104 | | if (property.NameEquals("type")) |
| | 105 | | { |
| 0 | 106 | | type = property.Value.GetString(); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("connectVia")) |
| | 110 | | { |
| 0 | 111 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); |
| 0 | 112 | | continue; |
| | 113 | | } |
| 0 | 114 | | if (property.NameEquals("description")) |
| | 115 | | { |
| 0 | 116 | | description = property.Value.GetString(); |
| 0 | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | if (property.NameEquals("parameters")) |
| | 120 | | { |
| 0 | 121 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 122 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 123 | | { |
| 0 | 124 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 125 | | } |
| 0 | 126 | | parameters = dictionary; |
| 0 | 127 | | continue; |
| | 128 | | } |
| 0 | 129 | | if (property.NameEquals("annotations")) |
| | 130 | | { |
| 0 | 131 | | List<object> array = new List<object>(); |
| 0 | 132 | | foreach (var item in property.Value.EnumerateArray()) |
| | 133 | | { |
| 0 | 134 | | array.Add(item.GetObject()); |
| | 135 | | } |
| 0 | 136 | | annotations = array; |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property.NameEquals("typeProperties")) |
| | 140 | | { |
| 0 | 141 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 142 | | { |
| 0 | 143 | | if (property0.NameEquals("environmentUrl")) |
| | 144 | | { |
| 0 | 145 | | environmentUrl = property0.Value.GetObject(); |
| 0 | 146 | | continue; |
| | 147 | | } |
| 0 | 148 | | if (property0.NameEquals("username")) |
| | 149 | | { |
| 0 | 150 | | username = property0.Value.GetObject(); |
| 0 | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | if (property0.NameEquals("password")) |
| | 154 | | { |
| 0 | 155 | | password = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | if (property0.NameEquals("securityToken")) |
| | 159 | | { |
| 0 | 160 | | securityToken = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | if (property0.NameEquals("encryptedCredential")) |
| | 164 | | { |
| 0 | 165 | | encryptedCredential = property0.Value.GetObject(); |
| | 166 | | continue; |
| | 167 | | } |
| | 168 | | } |
| | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 172 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 173 | | } |
| 0 | 174 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 175 | | return new SalesforceLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(paramete |
| | 176 | | } |
| | 177 | | } |
| | 178 | | } |