| | 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 IfConditionActivity : 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 | | writer.WritePropertyName("typeProperties"); |
| 0 | 49 | | writer.WriteStartObject(); |
| 0 | 50 | | writer.WritePropertyName("expression"); |
| 0 | 51 | | writer.WriteObjectValue(Expression); |
| 0 | 52 | | if (Optional.IsCollectionDefined(IfTrueActivities)) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("ifTrueActivities"); |
| 0 | 55 | | writer.WriteStartArray(); |
| 0 | 56 | | foreach (var item in IfTrueActivities) |
| | 57 | | { |
| 0 | 58 | | writer.WriteObjectValue(item); |
| | 59 | | } |
| 0 | 60 | | writer.WriteEndArray(); |
| | 61 | | } |
| 0 | 62 | | if (Optional.IsCollectionDefined(IfFalseActivities)) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("ifFalseActivities"); |
| 0 | 65 | | writer.WriteStartArray(); |
| 0 | 66 | | foreach (var item in IfFalseActivities) |
| | 67 | | { |
| 0 | 68 | | writer.WriteObjectValue(item); |
| | 69 | | } |
| 0 | 70 | | writer.WriteEndArray(); |
| | 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 IfConditionActivity DeserializeIfConditionActivity(JsonElement element) |
| | 82 | | { |
| 0 | 83 | | string name = default; |
| 0 | 84 | | string type = default; |
| 0 | 85 | | Optional<string> description = default; |
| 0 | 86 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 87 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 88 | | Expression expression = default; |
| 0 | 89 | | Optional<IList<Activity>> ifTrueActivities = default; |
| 0 | 90 | | Optional<IList<Activity>> ifFalseActivities = default; |
| 0 | 91 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 92 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 93 | | foreach (var property in element.EnumerateObject()) |
| | 94 | | { |
| 0 | 95 | | if (property.NameEquals("name")) |
| | 96 | | { |
| 0 | 97 | | name = property.Value.GetString(); |
| 0 | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | if (property.NameEquals("type")) |
| | 101 | | { |
| 0 | 102 | | type = property.Value.GetString(); |
| 0 | 103 | | continue; |
| | 104 | | } |
| 0 | 105 | | if (property.NameEquals("description")) |
| | 106 | | { |
| 0 | 107 | | description = property.Value.GetString(); |
| 0 | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | if (property.NameEquals("dependsOn")) |
| | 111 | | { |
| 0 | 112 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 113 | | foreach (var item in property.Value.EnumerateArray()) |
| | 114 | | { |
| 0 | 115 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 116 | | } |
| 0 | 117 | | dependsOn = array; |
| 0 | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | if (property.NameEquals("userProperties")) |
| | 121 | | { |
| 0 | 122 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 123 | | foreach (var item in property.Value.EnumerateArray()) |
| | 124 | | { |
| 0 | 125 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 126 | | } |
| 0 | 127 | | userProperties = array; |
| 0 | 128 | | continue; |
| | 129 | | } |
| 0 | 130 | | if (property.NameEquals("typeProperties")) |
| | 131 | | { |
| 0 | 132 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 133 | | { |
| 0 | 134 | | if (property0.NameEquals("expression")) |
| | 135 | | { |
| 0 | 136 | | expression = Expression.DeserializeExpression(property0.Value); |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property0.NameEquals("ifTrueActivities")) |
| | 140 | | { |
| 0 | 141 | | List<Activity> array = new List<Activity>(); |
| 0 | 142 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 143 | | { |
| 0 | 144 | | array.Add(DeserializeActivity(item)); |
| | 145 | | } |
| 0 | 146 | | ifTrueActivities = array; |
| 0 | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | if (property0.NameEquals("ifFalseActivities")) |
| | 150 | | { |
| 0 | 151 | | List<Activity> array = new List<Activity>(); |
| 0 | 152 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 153 | | { |
| 0 | 154 | | array.Add(DeserializeActivity(item)); |
| | 155 | | } |
| 0 | 156 | | ifFalseActivities = array; |
| | 157 | | continue; |
| | 158 | | } |
| | 159 | | } |
| | 160 | | continue; |
| | 161 | | } |
| 0 | 162 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 163 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 164 | | } |
| 0 | 165 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 166 | | return new IfConditionActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(us |
| | 167 | | } |
| | 168 | | } |
| | 169 | | } |