| | 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 SparkRequest |
| | 15 | | { |
| | 16 | | internal static SparkRequest DeserializeSparkRequest(JsonElement element) |
| | 17 | | { |
| 0 | 18 | | Optional<string> name = default; |
| 0 | 19 | | Optional<string> file = default; |
| 0 | 20 | | Optional<string> className = default; |
| 0 | 21 | | Optional<IReadOnlyList<string>> args = default; |
| 0 | 22 | | Optional<IReadOnlyList<string>> jars = default; |
| 0 | 23 | | Optional<IReadOnlyList<string>> pyFiles = default; |
| 0 | 24 | | Optional<IReadOnlyList<string>> files = default; |
| 0 | 25 | | Optional<IReadOnlyList<string>> archives = default; |
| 0 | 26 | | Optional<IReadOnlyDictionary<string, string>> conf = default; |
| 0 | 27 | | Optional<string> driverMemory = default; |
| 0 | 28 | | Optional<int> driverCores = default; |
| 0 | 29 | | Optional<string> executorMemory = default; |
| 0 | 30 | | Optional<int> executorCores = default; |
| 0 | 31 | | Optional<int> numExecutors = default; |
| 0 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 0 | 34 | | if (property.NameEquals("name")) |
| | 35 | | { |
| 0 | 36 | | name = property.Value.GetString(); |
| 0 | 37 | | continue; |
| | 38 | | } |
| 0 | 39 | | if (property.NameEquals("file")) |
| | 40 | | { |
| 0 | 41 | | file = property.Value.GetString(); |
| 0 | 42 | | continue; |
| | 43 | | } |
| 0 | 44 | | if (property.NameEquals("className")) |
| | 45 | | { |
| 0 | 46 | | className = property.Value.GetString(); |
| 0 | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | if (property.NameEquals("args")) |
| | 50 | | { |
| 0 | 51 | | List<string> array = new List<string>(); |
| 0 | 52 | | foreach (var item in property.Value.EnumerateArray()) |
| | 53 | | { |
| 0 | 54 | | array.Add(item.GetString()); |
| | 55 | | } |
| 0 | 56 | | args = array; |
| 0 | 57 | | continue; |
| | 58 | | } |
| 0 | 59 | | if (property.NameEquals("jars")) |
| | 60 | | { |
| 0 | 61 | | List<string> array = new List<string>(); |
| 0 | 62 | | foreach (var item in property.Value.EnumerateArray()) |
| | 63 | | { |
| 0 | 64 | | array.Add(item.GetString()); |
| | 65 | | } |
| 0 | 66 | | jars = array; |
| 0 | 67 | | continue; |
| | 68 | | } |
| 0 | 69 | | if (property.NameEquals("pyFiles")) |
| | 70 | | { |
| 0 | 71 | | List<string> array = new List<string>(); |
| 0 | 72 | | foreach (var item in property.Value.EnumerateArray()) |
| | 73 | | { |
| 0 | 74 | | array.Add(item.GetString()); |
| | 75 | | } |
| 0 | 76 | | pyFiles = array; |
| 0 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("files")) |
| | 80 | | { |
| 0 | 81 | | List<string> array = new List<string>(); |
| 0 | 82 | | foreach (var item in property.Value.EnumerateArray()) |
| | 83 | | { |
| 0 | 84 | | array.Add(item.GetString()); |
| | 85 | | } |
| 0 | 86 | | files = array; |
| 0 | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | if (property.NameEquals("archives")) |
| | 90 | | { |
| 0 | 91 | | List<string> array = new List<string>(); |
| 0 | 92 | | foreach (var item in property.Value.EnumerateArray()) |
| | 93 | | { |
| 0 | 94 | | array.Add(item.GetString()); |
| | 95 | | } |
| 0 | 96 | | archives = array; |
| 0 | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | if (property.NameEquals("conf")) |
| | 100 | | { |
| 0 | 101 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 102 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 103 | | { |
| 0 | 104 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 105 | | } |
| 0 | 106 | | conf = dictionary; |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("driverMemory")) |
| | 110 | | { |
| 0 | 111 | | driverMemory = property.Value.GetString(); |
| 0 | 112 | | continue; |
| | 113 | | } |
| 0 | 114 | | if (property.NameEquals("driverCores")) |
| | 115 | | { |
| 0 | 116 | | driverCores = property.Value.GetInt32(); |
| 0 | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | if (property.NameEquals("executorMemory")) |
| | 120 | | { |
| 0 | 121 | | executorMemory = property.Value.GetString(); |
| 0 | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | if (property.NameEquals("executorCores")) |
| | 125 | | { |
| 0 | 126 | | executorCores = property.Value.GetInt32(); |
| 0 | 127 | | continue; |
| | 128 | | } |
| 0 | 129 | | if (property.NameEquals("numExecutors")) |
| | 130 | | { |
| 0 | 131 | | numExecutors = property.Value.GetInt32(); |
| | 132 | | continue; |
| | 133 | | } |
| | 134 | | } |
| 0 | 135 | | return new SparkRequest(name.Value, file.Value, className.Value, Optional.ToList(args), Optional.ToList(jars |
| | 136 | | } |
| | 137 | | } |
| | 138 | | } |