| | 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 SquareLinkedService : 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("clientId"); |
| 0 | 57 | | writer.WriteObjectValue(ClientId); |
| 0 | 58 | | if (Optional.IsDefined(ClientSecret)) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName("clientSecret"); |
| 0 | 61 | | writer.WriteObjectValue(ClientSecret); |
| | 62 | | } |
| 0 | 63 | | writer.WritePropertyName("redirectUri"); |
| 0 | 64 | | writer.WriteObjectValue(RedirectUri); |
| 0 | 65 | | if (Optional.IsDefined(UseEncryptedEndpoints)) |
| | 66 | | { |
| 0 | 67 | | writer.WritePropertyName("useEncryptedEndpoints"); |
| 0 | 68 | | writer.WriteObjectValue(UseEncryptedEndpoints); |
| | 69 | | } |
| 0 | 70 | | if (Optional.IsDefined(UseHostVerification)) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("useHostVerification"); |
| 0 | 73 | | writer.WriteObjectValue(UseHostVerification); |
| | 74 | | } |
| 0 | 75 | | if (Optional.IsDefined(UsePeerVerification)) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName("usePeerVerification"); |
| 0 | 78 | | writer.WriteObjectValue(UsePeerVerification); |
| | 79 | | } |
| 0 | 80 | | if (Optional.IsDefined(EncryptedCredential)) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("encryptedCredential"); |
| 0 | 83 | | writer.WriteObjectValue(EncryptedCredential); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndObject(); |
| 0 | 86 | | foreach (var item in AdditionalProperties) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName(item.Key); |
| 0 | 89 | | writer.WriteObjectValue(item.Value); |
| | 90 | | } |
| 0 | 91 | | writer.WriteEndObject(); |
| 0 | 92 | | } |
| | 93 | |
|
| | 94 | | internal static SquareLinkedService DeserializeSquareLinkedService(JsonElement element) |
| | 95 | | { |
| 0 | 96 | | string type = default; |
| 0 | 97 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 98 | | Optional<string> description = default; |
| 0 | 99 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 100 | | Optional<IList<object>> annotations = default; |
| 0 | 101 | | object host = default; |
| 0 | 102 | | object clientId = default; |
| 0 | 103 | | Optional<SecretBase> clientSecret = default; |
| 0 | 104 | | object redirectUri = default; |
| 0 | 105 | | Optional<object> useEncryptedEndpoints = default; |
| 0 | 106 | | Optional<object> useHostVerification = default; |
| 0 | 107 | | Optional<object> usePeerVerification = default; |
| 0 | 108 | | Optional<object> encryptedCredential = default; |
| 0 | 109 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 110 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 111 | | foreach (var property in element.EnumerateObject()) |
| | 112 | | { |
| 0 | 113 | | if (property.NameEquals("type")) |
| | 114 | | { |
| 0 | 115 | | type = property.Value.GetString(); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property.NameEquals("connectVia")) |
| | 119 | | { |
| 0 | 120 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); |
| 0 | 121 | | continue; |
| | 122 | | } |
| 0 | 123 | | if (property.NameEquals("description")) |
| | 124 | | { |
| 0 | 125 | | description = property.Value.GetString(); |
| 0 | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | if (property.NameEquals("parameters")) |
| | 129 | | { |
| 0 | 130 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 131 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 132 | | { |
| 0 | 133 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 134 | | } |
| 0 | 135 | | parameters = dictionary; |
| 0 | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | if (property.NameEquals("annotations")) |
| | 139 | | { |
| 0 | 140 | | List<object> array = new List<object>(); |
| 0 | 141 | | foreach (var item in property.Value.EnumerateArray()) |
| | 142 | | { |
| 0 | 143 | | array.Add(item.GetObject()); |
| | 144 | | } |
| 0 | 145 | | annotations = array; |
| 0 | 146 | | continue; |
| | 147 | | } |
| 0 | 148 | | if (property.NameEquals("typeProperties")) |
| | 149 | | { |
| 0 | 150 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 151 | | { |
| 0 | 152 | | if (property0.NameEquals("host")) |
| | 153 | | { |
| 0 | 154 | | host = property0.Value.GetObject(); |
| 0 | 155 | | continue; |
| | 156 | | } |
| 0 | 157 | | if (property0.NameEquals("clientId")) |
| | 158 | | { |
| 0 | 159 | | clientId = property0.Value.GetObject(); |
| 0 | 160 | | continue; |
| | 161 | | } |
| 0 | 162 | | if (property0.NameEquals("clientSecret")) |
| | 163 | | { |
| 0 | 164 | | clientSecret = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | if (property0.NameEquals("redirectUri")) |
| | 168 | | { |
| 0 | 169 | | redirectUri = property0.Value.GetObject(); |
| 0 | 170 | | continue; |
| | 171 | | } |
| 0 | 172 | | if (property0.NameEquals("useEncryptedEndpoints")) |
| | 173 | | { |
| 0 | 174 | | useEncryptedEndpoints = property0.Value.GetObject(); |
| 0 | 175 | | continue; |
| | 176 | | } |
| 0 | 177 | | if (property0.NameEquals("useHostVerification")) |
| | 178 | | { |
| 0 | 179 | | useHostVerification = property0.Value.GetObject(); |
| 0 | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | if (property0.NameEquals("usePeerVerification")) |
| | 183 | | { |
| 0 | 184 | | usePeerVerification = property0.Value.GetObject(); |
| 0 | 185 | | continue; |
| | 186 | | } |
| 0 | 187 | | if (property0.NameEquals("encryptedCredential")) |
| | 188 | | { |
| 0 | 189 | | encryptedCredential = property0.Value.GetObject(); |
| | 190 | | continue; |
| | 191 | | } |
| | 192 | | } |
| | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 196 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 197 | | } |
| 0 | 198 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 199 | | return new SquareLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), |
| | 200 | | } |
| | 201 | | } |
| | 202 | | } |