| | 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.Spark.Models |
| | 12 | | { |
| | 13 | | public partial class SparkServiceError |
| | 14 | | { |
| | 15 | | internal static SparkServiceError DeserializeSparkServiceError(JsonElement element) |
| | 16 | | { |
| 0 | 17 | | Optional<string> message = default; |
| 0 | 18 | | Optional<string> errorCode = default; |
| 0 | 19 | | Optional<SparkErrorSource> source = default; |
| 0 | 20 | | foreach (var property in element.EnumerateObject()) |
| | 21 | | { |
| 0 | 22 | | if (property.NameEquals("message")) |
| | 23 | | { |
| 0 | 24 | | message = property.Value.GetString(); |
| 0 | 25 | | continue; |
| | 26 | | } |
| 0 | 27 | | if (property.NameEquals("errorCode")) |
| | 28 | | { |
| 0 | 29 | | errorCode = property.Value.GetString(); |
| 0 | 30 | | continue; |
| | 31 | | } |
| 0 | 32 | | if (property.NameEquals("source")) |
| | 33 | | { |
| 0 | 34 | | source = new SparkErrorSource(property.Value.GetString()); |
| | 35 | | continue; |
| | 36 | | } |
| | 37 | | } |
| 0 | 38 | | return new SparkServiceError(message.Value, errorCode.Value, Optional.ToNullable(source)); |
| | 39 | | } |
| | 40 | | } |
| | 41 | | } |