| | 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 ControlActivity : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("name"); |
| 0 | 20 | | writer.WriteStringValue(Name); |
| 0 | 21 | | writer.WritePropertyName("type"); |
| 0 | 22 | | writer.WriteStringValue(Type); |
| 0 | 23 | | if (Optional.IsDefined(Description)) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("description"); |
| 0 | 26 | | writer.WriteStringValue(Description); |
| | 27 | | } |
| 0 | 28 | | if (Optional.IsCollectionDefined(DependsOn)) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("dependsOn"); |
| 0 | 31 | | writer.WriteStartArray(); |
| 0 | 32 | | foreach (var item in DependsOn) |
| | 33 | | { |
| 0 | 34 | | writer.WriteObjectValue(item); |
| | 35 | | } |
| 0 | 36 | | writer.WriteEndArray(); |
| | 37 | | } |
| 0 | 38 | | if (Optional.IsCollectionDefined(UserProperties)) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("userProperties"); |
| 0 | 41 | | writer.WriteStartArray(); |
| 0 | 42 | | foreach (var item in UserProperties) |
| | 43 | | { |
| 0 | 44 | | writer.WriteObjectValue(item); |
| | 45 | | } |
| 0 | 46 | | writer.WriteEndArray(); |
| | 47 | | } |
| 0 | 48 | | foreach (var item in AdditionalProperties) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName(item.Key); |
| 0 | 51 | | writer.WriteObjectValue(item.Value); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| 0 | 54 | | } |
| | 55 | |
|
| | 56 | | internal static ControlActivity DeserializeControlActivity(JsonElement element) |
| | 57 | | { |
| 0 | 58 | | string name = default; |
| 0 | 59 | | string type = default; |
| 0 | 60 | | Optional<string> description = default; |
| 0 | 61 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 62 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 63 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 64 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 65 | | foreach (var property in element.EnumerateObject()) |
| | 66 | | { |
| 0 | 67 | | if (property.NameEquals("name")) |
| | 68 | | { |
| 0 | 69 | | name = property.Value.GetString(); |
| 0 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("type")) |
| | 73 | | { |
| 0 | 74 | | type = property.Value.GetString(); |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("description")) |
| | 78 | | { |
| 0 | 79 | | description = property.Value.GetString(); |
| 0 | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | if (property.NameEquals("dependsOn")) |
| | 83 | | { |
| 0 | 84 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 85 | | foreach (var item in property.Value.EnumerateArray()) |
| | 86 | | { |
| 0 | 87 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 88 | | } |
| 0 | 89 | | dependsOn = array; |
| 0 | 90 | | continue; |
| | 91 | | } |
| 0 | 92 | | if (property.NameEquals("userProperties")) |
| | 93 | | { |
| 0 | 94 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 95 | | foreach (var item in property.Value.EnumerateArray()) |
| | 96 | | { |
| 0 | 97 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 98 | | } |
| 0 | 99 | | userProperties = array; |
| 0 | 100 | | continue; |
| | 101 | | } |
| 0 | 102 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 103 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 104 | | } |
| 0 | 105 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 106 | | return new ControlActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(userPr |
| | 107 | | } |
| | 108 | | } |
| | 109 | | } |