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