| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.Analytics.Synapse.Artifacts.Models |
| | 12 | | { |
| | 13 | | public partial class NotebookSessionProperties : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("driverMemory"); |
| 0 | 19 | | writer.WriteStringValue(DriverMemory); |
| 0 | 20 | | writer.WritePropertyName("driverCores"); |
| 0 | 21 | | writer.WriteNumberValue(DriverCores); |
| 0 | 22 | | writer.WritePropertyName("executorMemory"); |
| 0 | 23 | | writer.WriteStringValue(ExecutorMemory); |
| 0 | 24 | | writer.WritePropertyName("executorCores"); |
| 0 | 25 | | writer.WriteNumberValue(ExecutorCores); |
| 0 | 26 | | writer.WritePropertyName("numExecutors"); |
| 0 | 27 | | writer.WriteNumberValue(NumExecutors); |
| 0 | 28 | | writer.WriteEndObject(); |
| 0 | 29 | | } |
| | 30 | |
|
| | 31 | | internal static NotebookSessionProperties DeserializeNotebookSessionProperties(JsonElement element) |
| | 32 | | { |
| 24 | 33 | | string driverMemory = default; |
| 24 | 34 | | int driverCores = default; |
| 24 | 35 | | string executorMemory = default; |
| 24 | 36 | | int executorCores = default; |
| 24 | 37 | | int numExecutors = default; |
| 288 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 120 | 40 | | if (property.NameEquals("driverMemory")) |
| | 41 | | { |
| 24 | 42 | | driverMemory = property.Value.GetString(); |
| 24 | 43 | | continue; |
| | 44 | | } |
| 96 | 45 | | if (property.NameEquals("driverCores")) |
| | 46 | | { |
| 24 | 47 | | driverCores = property.Value.GetInt32(); |
| 24 | 48 | | continue; |
| | 49 | | } |
| 72 | 50 | | if (property.NameEquals("executorMemory")) |
| | 51 | | { |
| 24 | 52 | | executorMemory = property.Value.GetString(); |
| 24 | 53 | | continue; |
| | 54 | | } |
| 48 | 55 | | if (property.NameEquals("executorCores")) |
| | 56 | | { |
| 24 | 57 | | executorCores = property.Value.GetInt32(); |
| 24 | 58 | | continue; |
| | 59 | | } |
| 24 | 60 | | if (property.NameEquals("numExecutors")) |
| | 61 | | { |
| 24 | 62 | | numExecutors = property.Value.GetInt32(); |
| | 63 | | continue; |
| | 64 | | } |
| | 65 | | } |
| 24 | 66 | | return new NotebookSessionProperties(driverMemory, driverCores, executorMemory, executorCores, numExecutors) |
| | 67 | | } |
| | 68 | | } |
| | 69 | | } |