| | 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 QuickBooksLinkedService : 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("endpoint"); |
| 0 | 55 | | writer.WriteObjectValue(Endpoint); |
| 0 | 56 | | writer.WritePropertyName("companyId"); |
| 0 | 57 | | writer.WriteObjectValue(CompanyId); |
| 0 | 58 | | writer.WritePropertyName("consumerKey"); |
| 0 | 59 | | writer.WriteObjectValue(ConsumerKey); |
| 0 | 60 | | writer.WritePropertyName("consumerSecret"); |
| 0 | 61 | | writer.WriteObjectValue(ConsumerSecret); |
| 0 | 62 | | writer.WritePropertyName("accessToken"); |
| 0 | 63 | | writer.WriteObjectValue(AccessToken); |
| 0 | 64 | | writer.WritePropertyName("accessTokenSecret"); |
| 0 | 65 | | writer.WriteObjectValue(AccessTokenSecret); |
| 0 | 66 | | if (Optional.IsDefined(UseEncryptedEndpoints)) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("useEncryptedEndpoints"); |
| 0 | 69 | | writer.WriteObjectValue(UseEncryptedEndpoints); |
| | 70 | | } |
| 0 | 71 | | if (Optional.IsDefined(EncryptedCredential)) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("encryptedCredential"); |
| 0 | 74 | | writer.WriteObjectValue(EncryptedCredential); |
| | 75 | | } |
| 0 | 76 | | writer.WriteEndObject(); |
| 0 | 77 | | foreach (var item in AdditionalProperties) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName(item.Key); |
| 0 | 80 | | writer.WriteObjectValue(item.Value); |
| | 81 | | } |
| 0 | 82 | | writer.WriteEndObject(); |
| 0 | 83 | | } |
| | 84 | |
|
| | 85 | | internal static QuickBooksLinkedService DeserializeQuickBooksLinkedService(JsonElement element) |
| | 86 | | { |
| 0 | 87 | | string type = default; |
| 0 | 88 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 89 | | Optional<string> description = default; |
| 0 | 90 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 91 | | Optional<IList<object>> annotations = default; |
| 0 | 92 | | object endpoint = default; |
| 0 | 93 | | object companyId = default; |
| 0 | 94 | | object consumerKey = default; |
| 0 | 95 | | SecretBase consumerSecret = default; |
| 0 | 96 | | SecretBase accessToken = default; |
| 0 | 97 | | SecretBase accessTokenSecret = default; |
| 0 | 98 | | Optional<object> useEncryptedEndpoints = 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("endpoint")) |
| | 144 | | { |
| 0 | 145 | | endpoint = property0.Value.GetObject(); |
| 0 | 146 | | continue; |
| | 147 | | } |
| 0 | 148 | | if (property0.NameEquals("companyId")) |
| | 149 | | { |
| 0 | 150 | | companyId = property0.Value.GetObject(); |
| 0 | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | if (property0.NameEquals("consumerKey")) |
| | 154 | | { |
| 0 | 155 | | consumerKey = property0.Value.GetObject(); |
| 0 | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | if (property0.NameEquals("consumerSecret")) |
| | 159 | | { |
| 0 | 160 | | consumerSecret = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | if (property0.NameEquals("accessToken")) |
| | 164 | | { |
| 0 | 165 | | accessToken = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 166 | | continue; |
| | 167 | | } |
| 0 | 168 | | if (property0.NameEquals("accessTokenSecret")) |
| | 169 | | { |
| 0 | 170 | | accessTokenSecret = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 171 | | continue; |
| | 172 | | } |
| 0 | 173 | | if (property0.NameEquals("useEncryptedEndpoints")) |
| | 174 | | { |
| 0 | 175 | | useEncryptedEndpoints = property0.Value.GetObject(); |
| 0 | 176 | | continue; |
| | 177 | | } |
| 0 | 178 | | if (property0.NameEquals("encryptedCredential")) |
| | 179 | | { |
| 0 | 180 | | encryptedCredential = property0.Value.GetObject(); |
| | 181 | | continue; |
| | 182 | | } |
| | 183 | | } |
| | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 187 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 188 | | } |
| 0 | 189 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 190 | | return new QuickBooksLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(paramete |
| | 191 | | } |
| | 192 | | } |
| | 193 | | } |