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