| | 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 SwitchActivity : 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("on"); |
| 0 | 51 | | writer.WriteObjectValue(On); |
| 0 | 52 | | if (Optional.IsCollectionDefined(Cases)) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("cases"); |
| 0 | 55 | | writer.WriteStartArray(); |
| 0 | 56 | | foreach (var item in Cases) |
| | 57 | | { |
| 0 | 58 | | writer.WriteObjectValue(item); |
| | 59 | | } |
| 0 | 60 | | writer.WriteEndArray(); |
| | 61 | | } |
| 0 | 62 | | if (Optional.IsCollectionDefined(DefaultActivities)) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("defaultActivities"); |
| 0 | 65 | | writer.WriteStartArray(); |
| 0 | 66 | | foreach (var item in DefaultActivities) |
| | 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 SwitchActivity DeserializeSwitchActivity(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 @on = default; |
| 0 | 89 | | Optional<IList<SwitchCase>> cases = default; |
| 0 | 90 | | Optional<IList<Activity>> defaultActivities = 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("on")) |
| | 135 | | { |
| 0 | 136 | | @on = Expression.DeserializeExpression(property0.Value); |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property0.NameEquals("cases")) |
| | 140 | | { |
| 0 | 141 | | List<SwitchCase> array = new List<SwitchCase>(); |
| 0 | 142 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 143 | | { |
| 0 | 144 | | array.Add(SwitchCase.DeserializeSwitchCase(item)); |
| | 145 | | } |
| 0 | 146 | | cases = array; |
| 0 | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | if (property0.NameEquals("defaultActivities")) |
| | 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 | | defaultActivities = 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 SwitchActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(userPro |
| | 167 | | } |
| | 168 | | } |
| | 169 | | } |