| | 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.ResourceManager.Resources.Models |
| | 13 | | { |
| | 14 | | public partial class WhatIfOperationResult |
| | 15 | | { |
| | 16 | | internal static WhatIfOperationResult DeserializeWhatIfOperationResult(JsonElement element) |
| | 17 | | { |
| 44 | 18 | | string status = default; |
| 44 | 19 | | ErrorResponse error = default; |
| 44 | 20 | | IReadOnlyList<WhatIfChange> changes = default; |
| 264 | 21 | | foreach (var property in element.EnumerateObject()) |
| | 22 | | { |
| 88 | 23 | | if (property.NameEquals("status")) |
| | 24 | | { |
| 44 | 25 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 26 | | { |
| | 27 | | continue; |
| | 28 | | } |
| 44 | 29 | | status = property.Value.GetString(); |
| 44 | 30 | | continue; |
| | 31 | | } |
| 44 | 32 | | if (property.NameEquals("error")) |
| | 33 | | { |
| 0 | 34 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 35 | | { |
| | 36 | | continue; |
| | 37 | | } |
| 0 | 38 | | error = ErrorResponse.DeserializeErrorResponse(property.Value); |
| 0 | 39 | | continue; |
| | 40 | | } |
| 44 | 41 | | if (property.NameEquals("properties")) |
| | 42 | | { |
| 176 | 43 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 44 | | { |
| 44 | 45 | | if (property0.NameEquals("changes")) |
| | 46 | | { |
| 44 | 47 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| | 49 | | continue; |
| | 50 | | } |
| 44 | 51 | | List<WhatIfChange> array = new List<WhatIfChange>(); |
| 216 | 52 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 53 | | { |
| 64 | 54 | | if (item.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| 0 | 56 | | array.Add(null); |
| | 57 | | } |
| | 58 | | else |
| | 59 | | { |
| 64 | 60 | | array.Add(WhatIfChange.DeserializeWhatIfChange(item)); |
| | 61 | | } |
| | 62 | | } |
| 44 | 63 | | changes = array; |
| | 64 | | continue; |
| | 65 | | } |
| | 66 | | } |
| | 67 | | continue; |
| | 68 | | } |
| | 69 | | } |
| 44 | 70 | | return new WhatIfOperationResult(status, error, changes); |
| | 71 | | } |
| | 72 | | } |
| | 73 | | } |