| | 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.Spark.Models |
| | 13 | | { |
| | 14 | | public partial class SparkBatchJob |
| | 15 | | { |
| | 16 | | internal static SparkBatchJob DeserializeSparkBatchJob(JsonElement element) |
| | 17 | | { |
| 160 | 18 | | Optional<SparkBatchJobState> livyInfo = default; |
| 160 | 19 | | Optional<string> name = default; |
| 160 | 20 | | Optional<string> workspaceName = default; |
| 160 | 21 | | Optional<string> sparkPoolName = default; |
| 160 | 22 | | Optional<string> submitterName = default; |
| 160 | 23 | | Optional<string> submitterId = default; |
| 160 | 24 | | Optional<string> artifactId = default; |
| 160 | 25 | | Optional<SparkJobType> jobType = default; |
| 160 | 26 | | Optional<SparkBatchJobResultType> result = default; |
| 160 | 27 | | Optional<SparkScheduler> schedulerInfo = default; |
| 160 | 28 | | Optional<SparkServicePlugin> pluginInfo = default; |
| 160 | 29 | | Optional<IReadOnlyList<SparkServiceError>> errorInfo = default; |
| 160 | 30 | | Optional<IReadOnlyDictionary<string, string>> tags = default; |
| 160 | 31 | | int id = default; |
| 160 | 32 | | Optional<string> appId = default; |
| 160 | 33 | | Optional<IReadOnlyDictionary<string, string>> appInfo = default; |
| 160 | 34 | | Optional<string> state = default; |
| 160 | 35 | | Optional<IReadOnlyList<string>> log = default; |
| 1920 | 36 | | foreach (var property in element.EnumerateObject()) |
| | 37 | | { |
| 800 | 38 | | if (property.NameEquals("livyInfo")) |
| | 39 | | { |
| 0 | 40 | | livyInfo = SparkBatchJobState.DeserializeSparkBatchJobState(property.Value); |
| 0 | 41 | | continue; |
| | 42 | | } |
| 800 | 43 | | if (property.NameEquals("name")) |
| | 44 | | { |
| 0 | 45 | | name = property.Value.GetString(); |
| 0 | 46 | | continue; |
| | 47 | | } |
| 800 | 48 | | if (property.NameEquals("workspaceName")) |
| | 49 | | { |
| 0 | 50 | | workspaceName = property.Value.GetString(); |
| 0 | 51 | | continue; |
| | 52 | | } |
| 800 | 53 | | if (property.NameEquals("sparkPoolName")) |
| | 54 | | { |
| 0 | 55 | | sparkPoolName = property.Value.GetString(); |
| 0 | 56 | | continue; |
| | 57 | | } |
| 800 | 58 | | if (property.NameEquals("submitterName")) |
| | 59 | | { |
| 0 | 60 | | submitterName = property.Value.GetString(); |
| 0 | 61 | | continue; |
| | 62 | | } |
| 800 | 63 | | if (property.NameEquals("submitterId")) |
| | 64 | | { |
| 0 | 65 | | submitterId = property.Value.GetString(); |
| 0 | 66 | | continue; |
| | 67 | | } |
| 800 | 68 | | if (property.NameEquals("artifactId")) |
| | 69 | | { |
| 0 | 70 | | artifactId = property.Value.GetString(); |
| 0 | 71 | | continue; |
| | 72 | | } |
| 800 | 73 | | if (property.NameEquals("jobType")) |
| | 74 | | { |
| 0 | 75 | | jobType = new SparkJobType(property.Value.GetString()); |
| 0 | 76 | | continue; |
| | 77 | | } |
| 800 | 78 | | if (property.NameEquals("result")) |
| | 79 | | { |
| 0 | 80 | | result = new SparkBatchJobResultType(property.Value.GetString()); |
| 0 | 81 | | continue; |
| | 82 | | } |
| 800 | 83 | | if (property.NameEquals("schedulerInfo")) |
| | 84 | | { |
| 0 | 85 | | schedulerInfo = SparkScheduler.DeserializeSparkScheduler(property.Value); |
| 0 | 86 | | continue; |
| | 87 | | } |
| 800 | 88 | | if (property.NameEquals("pluginInfo")) |
| | 89 | | { |
| 0 | 90 | | pluginInfo = SparkServicePlugin.DeserializeSparkServicePlugin(property.Value); |
| 0 | 91 | | continue; |
| | 92 | | } |
| 800 | 93 | | if (property.NameEquals("errorInfo")) |
| | 94 | | { |
| 0 | 95 | | List<SparkServiceError> array = new List<SparkServiceError>(); |
| 0 | 96 | | foreach (var item in property.Value.EnumerateArray()) |
| | 97 | | { |
| 0 | 98 | | array.Add(SparkServiceError.DeserializeSparkServiceError(item)); |
| | 99 | | } |
| 0 | 100 | | errorInfo = array; |
| 0 | 101 | | continue; |
| | 102 | | } |
| 800 | 103 | | if (property.NameEquals("tags")) |
| | 104 | | { |
| 0 | 105 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 106 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 107 | | { |
| 0 | 108 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 109 | | } |
| 0 | 110 | | tags = dictionary; |
| 0 | 111 | | continue; |
| | 112 | | } |
| 800 | 113 | | if (property.NameEquals("id")) |
| | 114 | | { |
| 160 | 115 | | id = property.Value.GetInt32(); |
| 160 | 116 | | continue; |
| | 117 | | } |
| 640 | 118 | | if (property.NameEquals("appId")) |
| | 119 | | { |
| 160 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| 32 | 122 | | appId = null; |
| 32 | 123 | | continue; |
| | 124 | | } |
| 128 | 125 | | appId = property.Value.GetString(); |
| 128 | 126 | | continue; |
| | 127 | | } |
| 480 | 128 | | if (property.NameEquals("appInfo")) |
| | 129 | | { |
| 160 | 130 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| 16 | 132 | | appInfo = null; |
| 16 | 133 | | continue; |
| | 134 | | } |
| 144 | 135 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 864 | 136 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 137 | | { |
| 288 | 138 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 139 | | } |
| 144 | 140 | | appInfo = dictionary; |
| 144 | 141 | | continue; |
| | 142 | | } |
| 320 | 143 | | if (property.NameEquals("state")) |
| | 144 | | { |
| 160 | 145 | | state = property.Value.GetString(); |
| 160 | 146 | | continue; |
| | 147 | | } |
| 160 | 148 | | if (property.NameEquals("log")) |
| | 149 | | { |
| 160 | 150 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 151 | | { |
| 16 | 152 | | log = null; |
| 16 | 153 | | continue; |
| | 154 | | } |
| 144 | 155 | | List<string> array = new List<string>(); |
| 3056 | 156 | | foreach (var item in property.Value.EnumerateArray()) |
| | 157 | | { |
| 1384 | 158 | | array.Add(item.GetString()); |
| | 159 | | } |
| 144 | 160 | | log = array; |
| | 161 | | continue; |
| | 162 | | } |
| | 163 | | } |
| 160 | 164 | | return new SparkBatchJob(livyInfo.Value, name.Value, workspaceName.Value, sparkPoolName.Value, submitterName |
| | 165 | | } |
| | 166 | | } |
| | 167 | | } |