| | 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 HDInsightHiveActivity : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsDefined(LinkedServiceName)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("linkedServiceName"); |
| 0 | 22 | | writer.WriteObjectValue(LinkedServiceName); |
| | 23 | | } |
| 0 | 24 | | if (Optional.IsDefined(Policy)) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("policy"); |
| 0 | 27 | | writer.WriteObjectValue(Policy); |
| | 28 | | } |
| 0 | 29 | | writer.WritePropertyName("name"); |
| 0 | 30 | | writer.WriteStringValue(Name); |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| 0 | 33 | | if (Optional.IsDefined(Description)) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName("description"); |
| 0 | 36 | | writer.WriteStringValue(Description); |
| | 37 | | } |
| 0 | 38 | | if (Optional.IsCollectionDefined(DependsOn)) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("dependsOn"); |
| 0 | 41 | | writer.WriteStartArray(); |
| 0 | 42 | | foreach (var item in DependsOn) |
| | 43 | | { |
| 0 | 44 | | writer.WriteObjectValue(item); |
| | 45 | | } |
| 0 | 46 | | writer.WriteEndArray(); |
| | 47 | | } |
| 0 | 48 | | if (Optional.IsCollectionDefined(UserProperties)) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName("userProperties"); |
| 0 | 51 | | writer.WriteStartArray(); |
| 0 | 52 | | foreach (var item in UserProperties) |
| | 53 | | { |
| 0 | 54 | | writer.WriteObjectValue(item); |
| | 55 | | } |
| 0 | 56 | | writer.WriteEndArray(); |
| | 57 | | } |
| 0 | 58 | | writer.WritePropertyName("typeProperties"); |
| 0 | 59 | | writer.WriteStartObject(); |
| 0 | 60 | | if (Optional.IsCollectionDefined(StorageLinkedServices)) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("storageLinkedServices"); |
| 0 | 63 | | writer.WriteStartArray(); |
| 0 | 64 | | foreach (var item in StorageLinkedServices) |
| | 65 | | { |
| 0 | 66 | | writer.WriteObjectValue(item); |
| | 67 | | } |
| 0 | 68 | | writer.WriteEndArray(); |
| | 69 | | } |
| 0 | 70 | | if (Optional.IsCollectionDefined(Arguments)) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("arguments"); |
| 0 | 73 | | writer.WriteStartArray(); |
| 0 | 74 | | foreach (var item in Arguments) |
| | 75 | | { |
| 0 | 76 | | writer.WriteObjectValue(item); |
| | 77 | | } |
| 0 | 78 | | writer.WriteEndArray(); |
| | 79 | | } |
| 0 | 80 | | if (Optional.IsDefined(GetDebugInfo)) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("getDebugInfo"); |
| 0 | 83 | | writer.WriteStringValue(GetDebugInfo.Value.ToString()); |
| | 84 | | } |
| 0 | 85 | | if (Optional.IsDefined(ScriptPath)) |
| | 86 | | { |
| 0 | 87 | | writer.WritePropertyName("scriptPath"); |
| 0 | 88 | | writer.WriteObjectValue(ScriptPath); |
| | 89 | | } |
| 0 | 90 | | if (Optional.IsDefined(ScriptLinkedService)) |
| | 91 | | { |
| 0 | 92 | | writer.WritePropertyName("scriptLinkedService"); |
| 0 | 93 | | writer.WriteObjectValue(ScriptLinkedService); |
| | 94 | | } |
| 0 | 95 | | if (Optional.IsCollectionDefined(Defines)) |
| | 96 | | { |
| 0 | 97 | | writer.WritePropertyName("defines"); |
| 0 | 98 | | writer.WriteStartObject(); |
| 0 | 99 | | foreach (var item in Defines) |
| | 100 | | { |
| 0 | 101 | | writer.WritePropertyName(item.Key); |
| 0 | 102 | | writer.WriteObjectValue(item.Value); |
| | 103 | | } |
| 0 | 104 | | writer.WriteEndObject(); |
| | 105 | | } |
| 0 | 106 | | if (Optional.IsCollectionDefined(Variables)) |
| | 107 | | { |
| 0 | 108 | | writer.WritePropertyName("variables"); |
| 0 | 109 | | writer.WriteStartArray(); |
| 0 | 110 | | foreach (var item in Variables) |
| | 111 | | { |
| 0 | 112 | | writer.WriteObjectValue(item); |
| | 113 | | } |
| 0 | 114 | | writer.WriteEndArray(); |
| | 115 | | } |
| 0 | 116 | | if (Optional.IsDefined(QueryTimeout)) |
| | 117 | | { |
| 0 | 118 | | writer.WritePropertyName("queryTimeout"); |
| 0 | 119 | | writer.WriteNumberValue(QueryTimeout.Value); |
| | 120 | | } |
| 0 | 121 | | writer.WriteEndObject(); |
| 0 | 122 | | foreach (var item in AdditionalProperties) |
| | 123 | | { |
| 0 | 124 | | writer.WritePropertyName(item.Key); |
| 0 | 125 | | writer.WriteObjectValue(item.Value); |
| | 126 | | } |
| 0 | 127 | | writer.WriteEndObject(); |
| 0 | 128 | | } |
| | 129 | |
|
| | 130 | | internal static HDInsightHiveActivity DeserializeHDInsightHiveActivity(JsonElement element) |
| | 131 | | { |
| 0 | 132 | | Optional<LinkedServiceReference> linkedServiceName = default; |
| 0 | 133 | | Optional<ActivityPolicy> policy = default; |
| 0 | 134 | | string name = default; |
| 0 | 135 | | string type = default; |
| 0 | 136 | | Optional<string> description = default; |
| 0 | 137 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 138 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 139 | | Optional<IList<LinkedServiceReference>> storageLinkedServices = default; |
| 0 | 140 | | Optional<IList<object>> arguments = default; |
| 0 | 141 | | Optional<HDInsightActivityDebugInfoOption> getDebugInfo = default; |
| 0 | 142 | | Optional<object> scriptPath = default; |
| 0 | 143 | | Optional<LinkedServiceReference> scriptLinkedService = default; |
| 0 | 144 | | Optional<IDictionary<string, object>> defines = default; |
| 0 | 145 | | Optional<IList<object>> variables = default; |
| 0 | 146 | | Optional<int> queryTimeout = default; |
| 0 | 147 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 148 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 149 | | foreach (var property in element.EnumerateObject()) |
| | 150 | | { |
| 0 | 151 | | if (property.NameEquals("linkedServiceName")) |
| | 152 | | { |
| 0 | 153 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | if (property.NameEquals("policy")) |
| | 157 | | { |
| 0 | 158 | | policy = ActivityPolicy.DeserializeActivityPolicy(property.Value); |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property.NameEquals("name")) |
| | 162 | | { |
| 0 | 163 | | name = property.Value.GetString(); |
| 0 | 164 | | continue; |
| | 165 | | } |
| 0 | 166 | | if (property.NameEquals("type")) |
| | 167 | | { |
| 0 | 168 | | type = property.Value.GetString(); |
| 0 | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | if (property.NameEquals("description")) |
| | 172 | | { |
| 0 | 173 | | description = property.Value.GetString(); |
| 0 | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | if (property.NameEquals("dependsOn")) |
| | 177 | | { |
| 0 | 178 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 179 | | foreach (var item in property.Value.EnumerateArray()) |
| | 180 | | { |
| 0 | 181 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 182 | | } |
| 0 | 183 | | dependsOn = array; |
| 0 | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | if (property.NameEquals("userProperties")) |
| | 187 | | { |
| 0 | 188 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 189 | | foreach (var item in property.Value.EnumerateArray()) |
| | 190 | | { |
| 0 | 191 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 192 | | } |
| 0 | 193 | | userProperties = array; |
| 0 | 194 | | continue; |
| | 195 | | } |
| 0 | 196 | | if (property.NameEquals("typeProperties")) |
| | 197 | | { |
| 0 | 198 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 199 | | { |
| 0 | 200 | | if (property0.NameEquals("storageLinkedServices")) |
| | 201 | | { |
| 0 | 202 | | List<LinkedServiceReference> array = new List<LinkedServiceReference>(); |
| 0 | 203 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 204 | | { |
| 0 | 205 | | array.Add(LinkedServiceReference.DeserializeLinkedServiceReference(item)); |
| | 206 | | } |
| 0 | 207 | | storageLinkedServices = array; |
| 0 | 208 | | continue; |
| | 209 | | } |
| 0 | 210 | | if (property0.NameEquals("arguments")) |
| | 211 | | { |
| 0 | 212 | | List<object> array = new List<object>(); |
| 0 | 213 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 214 | | { |
| 0 | 215 | | array.Add(item.GetObject()); |
| | 216 | | } |
| 0 | 217 | | arguments = array; |
| 0 | 218 | | continue; |
| | 219 | | } |
| 0 | 220 | | if (property0.NameEquals("getDebugInfo")) |
| | 221 | | { |
| 0 | 222 | | getDebugInfo = new HDInsightActivityDebugInfoOption(property0.Value.GetString()); |
| 0 | 223 | | continue; |
| | 224 | | } |
| 0 | 225 | | if (property0.NameEquals("scriptPath")) |
| | 226 | | { |
| 0 | 227 | | scriptPath = property0.Value.GetObject(); |
| 0 | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | if (property0.NameEquals("scriptLinkedService")) |
| | 231 | | { |
| 0 | 232 | | scriptLinkedService = LinkedServiceReference.DeserializeLinkedServiceReference(property0.Val |
| 0 | 233 | | continue; |
| | 234 | | } |
| 0 | 235 | | if (property0.NameEquals("defines")) |
| | 236 | | { |
| 0 | 237 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 238 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 239 | | { |
| 0 | 240 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 241 | | } |
| 0 | 242 | | defines = dictionary; |
| 0 | 243 | | continue; |
| | 244 | | } |
| 0 | 245 | | if (property0.NameEquals("variables")) |
| | 246 | | { |
| 0 | 247 | | List<object> array = new List<object>(); |
| 0 | 248 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 249 | | { |
| 0 | 250 | | array.Add(item.GetObject()); |
| | 251 | | } |
| 0 | 252 | | variables = array; |
| 0 | 253 | | continue; |
| | 254 | | } |
| 0 | 255 | | if (property0.NameEquals("queryTimeout")) |
| | 256 | | { |
| 0 | 257 | | queryTimeout = property0.Value.GetInt32(); |
| | 258 | | continue; |
| | 259 | | } |
| | 260 | | } |
| | 261 | | continue; |
| | 262 | | } |
| 0 | 263 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 264 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 265 | | } |
| 0 | 266 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 267 | | return new HDInsightHiveActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList( |
| | 268 | | } |
| | 269 | | } |
| | 270 | | } |