| | 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 HDInsightPigActivity : 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.IsDefined(Arguments)) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("arguments"); |
| 0 | 73 | | writer.WriteObjectValue(Arguments); |
| | 74 | | } |
| 0 | 75 | | if (Optional.IsDefined(GetDebugInfo)) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName("getDebugInfo"); |
| 0 | 78 | | writer.WriteStringValue(GetDebugInfo.Value.ToString()); |
| | 79 | | } |
| 0 | 80 | | if (Optional.IsDefined(ScriptPath)) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("scriptPath"); |
| 0 | 83 | | writer.WriteObjectValue(ScriptPath); |
| | 84 | | } |
| 0 | 85 | | if (Optional.IsDefined(ScriptLinkedService)) |
| | 86 | | { |
| 0 | 87 | | writer.WritePropertyName("scriptLinkedService"); |
| 0 | 88 | | writer.WriteObjectValue(ScriptLinkedService); |
| | 89 | | } |
| 0 | 90 | | if (Optional.IsCollectionDefined(Defines)) |
| | 91 | | { |
| 0 | 92 | | writer.WritePropertyName("defines"); |
| 0 | 93 | | writer.WriteStartObject(); |
| 0 | 94 | | foreach (var item in Defines) |
| | 95 | | { |
| 0 | 96 | | writer.WritePropertyName(item.Key); |
| 0 | 97 | | writer.WriteObjectValue(item.Value); |
| | 98 | | } |
| 0 | 99 | | writer.WriteEndObject(); |
| | 100 | | } |
| 0 | 101 | | writer.WriteEndObject(); |
| 0 | 102 | | foreach (var item in AdditionalProperties) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName(item.Key); |
| 0 | 105 | | writer.WriteObjectValue(item.Value); |
| | 106 | | } |
| 0 | 107 | | writer.WriteEndObject(); |
| 0 | 108 | | } |
| | 109 | |
|
| | 110 | | internal static HDInsightPigActivity DeserializeHDInsightPigActivity(JsonElement element) |
| | 111 | | { |
| 0 | 112 | | Optional<LinkedServiceReference> linkedServiceName = default; |
| 0 | 113 | | Optional<ActivityPolicy> policy = default; |
| 0 | 114 | | string name = default; |
| 0 | 115 | | string type = default; |
| 0 | 116 | | Optional<string> description = default; |
| 0 | 117 | | Optional<IList<ActivityDependency>> dependsOn = default; |
| 0 | 118 | | Optional<IList<UserProperty>> userProperties = default; |
| 0 | 119 | | Optional<IList<LinkedServiceReference>> storageLinkedServices = default; |
| 0 | 120 | | Optional<object> arguments = default; |
| 0 | 121 | | Optional<HDInsightActivityDebugInfoOption> getDebugInfo = default; |
| 0 | 122 | | Optional<object> scriptPath = default; |
| 0 | 123 | | Optional<LinkedServiceReference> scriptLinkedService = default; |
| 0 | 124 | | Optional<IDictionary<string, object>> defines = default; |
| 0 | 125 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 126 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 127 | | foreach (var property in element.EnumerateObject()) |
| | 128 | | { |
| 0 | 129 | | if (property.NameEquals("linkedServiceName")) |
| | 130 | | { |
| 0 | 131 | | linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property.NameEquals("policy")) |
| | 135 | | { |
| 0 | 136 | | policy = ActivityPolicy.DeserializeActivityPolicy(property.Value); |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property.NameEquals("name")) |
| | 140 | | { |
| 0 | 141 | | name = property.Value.GetString(); |
| 0 | 142 | | continue; |
| | 143 | | } |
| 0 | 144 | | if (property.NameEquals("type")) |
| | 145 | | { |
| 0 | 146 | | type = property.Value.GetString(); |
| 0 | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | if (property.NameEquals("description")) |
| | 150 | | { |
| 0 | 151 | | description = property.Value.GetString(); |
| 0 | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | if (property.NameEquals("dependsOn")) |
| | 155 | | { |
| 0 | 156 | | List<ActivityDependency> array = new List<ActivityDependency>(); |
| 0 | 157 | | foreach (var item in property.Value.EnumerateArray()) |
| | 158 | | { |
| 0 | 159 | | array.Add(ActivityDependency.DeserializeActivityDependency(item)); |
| | 160 | | } |
| 0 | 161 | | dependsOn = array; |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property.NameEquals("userProperties")) |
| | 165 | | { |
| 0 | 166 | | List<UserProperty> array = new List<UserProperty>(); |
| 0 | 167 | | foreach (var item in property.Value.EnumerateArray()) |
| | 168 | | { |
| 0 | 169 | | array.Add(UserProperty.DeserializeUserProperty(item)); |
| | 170 | | } |
| 0 | 171 | | userProperties = array; |
| 0 | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | if (property.NameEquals("typeProperties")) |
| | 175 | | { |
| 0 | 176 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 177 | | { |
| 0 | 178 | | if (property0.NameEquals("storageLinkedServices")) |
| | 179 | | { |
| 0 | 180 | | List<LinkedServiceReference> array = new List<LinkedServiceReference>(); |
| 0 | 181 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 182 | | { |
| 0 | 183 | | array.Add(LinkedServiceReference.DeserializeLinkedServiceReference(item)); |
| | 184 | | } |
| 0 | 185 | | storageLinkedServices = array; |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property0.NameEquals("arguments")) |
| | 189 | | { |
| 0 | 190 | | arguments = property0.Value.GetObject(); |
| 0 | 191 | | continue; |
| | 192 | | } |
| 0 | 193 | | if (property0.NameEquals("getDebugInfo")) |
| | 194 | | { |
| 0 | 195 | | getDebugInfo = new HDInsightActivityDebugInfoOption(property0.Value.GetString()); |
| 0 | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | if (property0.NameEquals("scriptPath")) |
| | 199 | | { |
| 0 | 200 | | scriptPath = property0.Value.GetObject(); |
| 0 | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | if (property0.NameEquals("scriptLinkedService")) |
| | 204 | | { |
| 0 | 205 | | scriptLinkedService = LinkedServiceReference.DeserializeLinkedServiceReference(property0.Val |
| 0 | 206 | | continue; |
| | 207 | | } |
| 0 | 208 | | if (property0.NameEquals("defines")) |
| | 209 | | { |
| 0 | 210 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 211 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 212 | | { |
| 0 | 213 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 214 | | } |
| 0 | 215 | | defines = dictionary; |
| | 216 | | continue; |
| | 217 | | } |
| | 218 | | } |
| | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 222 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 223 | | } |
| 0 | 224 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 225 | | return new HDInsightPigActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(u |
| | 226 | | } |
| | 227 | | } |
| | 228 | | } |