| | 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 AzureDatabricksLinkedService : 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("domain"); |
| 0 | 55 | | writer.WriteObjectValue(Domain); |
| 0 | 56 | | writer.WritePropertyName("accessToken"); |
| 0 | 57 | | writer.WriteObjectValue(AccessToken); |
| 0 | 58 | | if (Optional.IsDefined(ExistingClusterId)) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName("existingClusterId"); |
| 0 | 61 | | writer.WriteObjectValue(ExistingClusterId); |
| | 62 | | } |
| 0 | 63 | | if (Optional.IsDefined(InstancePoolId)) |
| | 64 | | { |
| 0 | 65 | | writer.WritePropertyName("instancePoolId"); |
| 0 | 66 | | writer.WriteObjectValue(InstancePoolId); |
| | 67 | | } |
| 0 | 68 | | if (Optional.IsDefined(NewClusterVersion)) |
| | 69 | | { |
| 0 | 70 | | writer.WritePropertyName("newClusterVersion"); |
| 0 | 71 | | writer.WriteObjectValue(NewClusterVersion); |
| | 72 | | } |
| 0 | 73 | | if (Optional.IsDefined(NewClusterNumOfWorker)) |
| | 74 | | { |
| 0 | 75 | | writer.WritePropertyName("newClusterNumOfWorker"); |
| 0 | 76 | | writer.WriteObjectValue(NewClusterNumOfWorker); |
| | 77 | | } |
| 0 | 78 | | if (Optional.IsDefined(NewClusterNodeType)) |
| | 79 | | { |
| 0 | 80 | | writer.WritePropertyName("newClusterNodeType"); |
| 0 | 81 | | writer.WriteObjectValue(NewClusterNodeType); |
| | 82 | | } |
| 0 | 83 | | if (Optional.IsCollectionDefined(NewClusterSparkConf)) |
| | 84 | | { |
| 0 | 85 | | writer.WritePropertyName("newClusterSparkConf"); |
| 0 | 86 | | writer.WriteStartObject(); |
| 0 | 87 | | foreach (var item in NewClusterSparkConf) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName(item.Key); |
| 0 | 90 | | writer.WriteObjectValue(item.Value); |
| | 91 | | } |
| 0 | 92 | | writer.WriteEndObject(); |
| | 93 | | } |
| 0 | 94 | | if (Optional.IsCollectionDefined(NewClusterSparkEnvVars)) |
| | 95 | | { |
| 0 | 96 | | writer.WritePropertyName("newClusterSparkEnvVars"); |
| 0 | 97 | | writer.WriteStartObject(); |
| 0 | 98 | | foreach (var item in NewClusterSparkEnvVars) |
| | 99 | | { |
| 0 | 100 | | writer.WritePropertyName(item.Key); |
| 0 | 101 | | writer.WriteObjectValue(item.Value); |
| | 102 | | } |
| 0 | 103 | | writer.WriteEndObject(); |
| | 104 | | } |
| 0 | 105 | | if (Optional.IsCollectionDefined(NewClusterCustomTags)) |
| | 106 | | { |
| 0 | 107 | | writer.WritePropertyName("newClusterCustomTags"); |
| 0 | 108 | | writer.WriteStartObject(); |
| 0 | 109 | | foreach (var item in NewClusterCustomTags) |
| | 110 | | { |
| 0 | 111 | | writer.WritePropertyName(item.Key); |
| 0 | 112 | | writer.WriteObjectValue(item.Value); |
| | 113 | | } |
| 0 | 114 | | writer.WriteEndObject(); |
| | 115 | | } |
| 0 | 116 | | if (Optional.IsDefined(NewClusterDriverNodeType)) |
| | 117 | | { |
| 0 | 118 | | writer.WritePropertyName("newClusterDriverNodeType"); |
| 0 | 119 | | writer.WriteObjectValue(NewClusterDriverNodeType); |
| | 120 | | } |
| 0 | 121 | | if (Optional.IsDefined(NewClusterInitScripts)) |
| | 122 | | { |
| 0 | 123 | | writer.WritePropertyName("newClusterInitScripts"); |
| 0 | 124 | | writer.WriteObjectValue(NewClusterInitScripts); |
| | 125 | | } |
| 0 | 126 | | if (Optional.IsDefined(NewClusterEnableElasticDisk)) |
| | 127 | | { |
| 0 | 128 | | writer.WritePropertyName("newClusterEnableElasticDisk"); |
| 0 | 129 | | writer.WriteObjectValue(NewClusterEnableElasticDisk); |
| | 130 | | } |
| 0 | 131 | | if (Optional.IsDefined(EncryptedCredential)) |
| | 132 | | { |
| 0 | 133 | | writer.WritePropertyName("encryptedCredential"); |
| 0 | 134 | | writer.WriteObjectValue(EncryptedCredential); |
| | 135 | | } |
| 0 | 136 | | writer.WriteEndObject(); |
| 0 | 137 | | foreach (var item in AdditionalProperties) |
| | 138 | | { |
| 0 | 139 | | writer.WritePropertyName(item.Key); |
| 0 | 140 | | writer.WriteObjectValue(item.Value); |
| | 141 | | } |
| 0 | 142 | | writer.WriteEndObject(); |
| 0 | 143 | | } |
| | 144 | |
|
| | 145 | | internal static AzureDatabricksLinkedService DeserializeAzureDatabricksLinkedService(JsonElement element) |
| | 146 | | { |
| 0 | 147 | | string type = default; |
| 0 | 148 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 149 | | Optional<string> description = default; |
| 0 | 150 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 151 | | Optional<IList<object>> annotations = default; |
| 0 | 152 | | object domain = default; |
| 0 | 153 | | SecretBase accessToken = default; |
| 0 | 154 | | Optional<object> existingClusterId = default; |
| 0 | 155 | | Optional<object> instancePoolId = default; |
| 0 | 156 | | Optional<object> newClusterVersion = default; |
| 0 | 157 | | Optional<object> newClusterNumOfWorker = default; |
| 0 | 158 | | Optional<object> newClusterNodeType = default; |
| 0 | 159 | | Optional<IDictionary<string, object>> newClusterSparkConf = default; |
| 0 | 160 | | Optional<IDictionary<string, object>> newClusterSparkEnvVars = default; |
| 0 | 161 | | Optional<IDictionary<string, object>> newClusterCustomTags = default; |
| 0 | 162 | | Optional<object> newClusterDriverNodeType = default; |
| 0 | 163 | | Optional<object> newClusterInitScripts = default; |
| 0 | 164 | | Optional<object> newClusterEnableElasticDisk = default; |
| 0 | 165 | | Optional<object> encryptedCredential = default; |
| 0 | 166 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 167 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 168 | | foreach (var property in element.EnumerateObject()) |
| | 169 | | { |
| 0 | 170 | | if (property.NameEquals("type")) |
| | 171 | | { |
| 0 | 172 | | type = property.Value.GetString(); |
| 0 | 173 | | continue; |
| | 174 | | } |
| 0 | 175 | | if (property.NameEquals("connectVia")) |
| | 176 | | { |
| 0 | 177 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); |
| 0 | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | if (property.NameEquals("description")) |
| | 181 | | { |
| 0 | 182 | | description = property.Value.GetString(); |
| 0 | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | if (property.NameEquals("parameters")) |
| | 186 | | { |
| 0 | 187 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 188 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 189 | | { |
| 0 | 190 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 191 | | } |
| 0 | 192 | | parameters = dictionary; |
| 0 | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | if (property.NameEquals("annotations")) |
| | 196 | | { |
| 0 | 197 | | List<object> array = new List<object>(); |
| 0 | 198 | | foreach (var item in property.Value.EnumerateArray()) |
| | 199 | | { |
| 0 | 200 | | array.Add(item.GetObject()); |
| | 201 | | } |
| 0 | 202 | | annotations = array; |
| 0 | 203 | | continue; |
| | 204 | | } |
| 0 | 205 | | if (property.NameEquals("typeProperties")) |
| | 206 | | { |
| 0 | 207 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 208 | | { |
| 0 | 209 | | if (property0.NameEquals("domain")) |
| | 210 | | { |
| 0 | 211 | | domain = property0.Value.GetObject(); |
| 0 | 212 | | continue; |
| | 213 | | } |
| 0 | 214 | | if (property0.NameEquals("accessToken")) |
| | 215 | | { |
| 0 | 216 | | accessToken = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 217 | | continue; |
| | 218 | | } |
| 0 | 219 | | if (property0.NameEquals("existingClusterId")) |
| | 220 | | { |
| 0 | 221 | | existingClusterId = property0.Value.GetObject(); |
| 0 | 222 | | continue; |
| | 223 | | } |
| 0 | 224 | | if (property0.NameEquals("instancePoolId")) |
| | 225 | | { |
| 0 | 226 | | instancePoolId = property0.Value.GetObject(); |
| 0 | 227 | | continue; |
| | 228 | | } |
| 0 | 229 | | if (property0.NameEquals("newClusterVersion")) |
| | 230 | | { |
| 0 | 231 | | newClusterVersion = property0.Value.GetObject(); |
| 0 | 232 | | continue; |
| | 233 | | } |
| 0 | 234 | | if (property0.NameEquals("newClusterNumOfWorker")) |
| | 235 | | { |
| 0 | 236 | | newClusterNumOfWorker = property0.Value.GetObject(); |
| 0 | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | if (property0.NameEquals("newClusterNodeType")) |
| | 240 | | { |
| 0 | 241 | | newClusterNodeType = property0.Value.GetObject(); |
| 0 | 242 | | continue; |
| | 243 | | } |
| 0 | 244 | | if (property0.NameEquals("newClusterSparkConf")) |
| | 245 | | { |
| 0 | 246 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 247 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 248 | | { |
| 0 | 249 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 250 | | } |
| 0 | 251 | | newClusterSparkConf = dictionary; |
| 0 | 252 | | continue; |
| | 253 | | } |
| 0 | 254 | | if (property0.NameEquals("newClusterSparkEnvVars")) |
| | 255 | | { |
| 0 | 256 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 257 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 258 | | { |
| 0 | 259 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 260 | | } |
| 0 | 261 | | newClusterSparkEnvVars = dictionary; |
| 0 | 262 | | continue; |
| | 263 | | } |
| 0 | 264 | | if (property0.NameEquals("newClusterCustomTags")) |
| | 265 | | { |
| 0 | 266 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 267 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 268 | | { |
| 0 | 269 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 270 | | } |
| 0 | 271 | | newClusterCustomTags = dictionary; |
| 0 | 272 | | continue; |
| | 273 | | } |
| 0 | 274 | | if (property0.NameEquals("newClusterDriverNodeType")) |
| | 275 | | { |
| 0 | 276 | | newClusterDriverNodeType = property0.Value.GetObject(); |
| 0 | 277 | | continue; |
| | 278 | | } |
| 0 | 279 | | if (property0.NameEquals("newClusterInitScripts")) |
| | 280 | | { |
| 0 | 281 | | newClusterInitScripts = property0.Value.GetObject(); |
| 0 | 282 | | continue; |
| | 283 | | } |
| 0 | 284 | | if (property0.NameEquals("newClusterEnableElasticDisk")) |
| | 285 | | { |
| 0 | 286 | | newClusterEnableElasticDisk = property0.Value.GetObject(); |
| 0 | 287 | | continue; |
| | 288 | | } |
| 0 | 289 | | if (property0.NameEquals("encryptedCredential")) |
| | 290 | | { |
| 0 | 291 | | encryptedCredential = property0.Value.GetObject(); |
| | 292 | | continue; |
| | 293 | | } |
| | 294 | | } |
| | 295 | | continue; |
| | 296 | | } |
| 0 | 297 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 298 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 299 | | } |
| 0 | 300 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 301 | | return new AzureDatabricksLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(par |
| | 302 | | } |
| | 303 | | } |
| | 304 | | } |