| | 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; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class RollingUpgradeRunningStatus : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Code != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("code"); |
| 0 | 22 | | writer.WriteStringValue(Code.Value.ToSerialString()); |
| | 23 | | } |
| 0 | 24 | | if (StartTime != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("startTime"); |
| 0 | 27 | | writer.WriteStringValue(StartTime.Value, "O"); |
| | 28 | | } |
| 0 | 29 | | if (LastAction != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("lastAction"); |
| 0 | 32 | | writer.WriteStringValue(LastAction.Value.ToSerialString()); |
| | 33 | | } |
| 0 | 34 | | if (LastActionTime != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("lastActionTime"); |
| 0 | 37 | | writer.WriteStringValue(LastActionTime.Value, "O"); |
| | 38 | | } |
| 0 | 39 | | writer.WriteEndObject(); |
| 0 | 40 | | } |
| | 41 | |
|
| | 42 | | internal static RollingUpgradeRunningStatus DeserializeRollingUpgradeRunningStatus(JsonElement element) |
| | 43 | | { |
| 0 | 44 | | RollingUpgradeStatusCode? code = default; |
| 0 | 45 | | DateTimeOffset? startTime = default; |
| 0 | 46 | | RollingUpgradeActionType? lastAction = default; |
| 0 | 47 | | DateTimeOffset? lastActionTime = default; |
| 0 | 48 | | foreach (var property in element.EnumerateObject()) |
| | 49 | | { |
| 0 | 50 | | if (property.NameEquals("code")) |
| | 51 | | { |
| 0 | 52 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 53 | | { |
| | 54 | | continue; |
| | 55 | | } |
| 0 | 56 | | code = property.Value.GetString().ToRollingUpgradeStatusCode(); |
| 0 | 57 | | continue; |
| | 58 | | } |
| 0 | 59 | | if (property.NameEquals("startTime")) |
| | 60 | | { |
| 0 | 61 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 62 | | { |
| | 63 | | continue; |
| | 64 | | } |
| 0 | 65 | | startTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 66 | | continue; |
| | 67 | | } |
| 0 | 68 | | if (property.NameEquals("lastAction")) |
| | 69 | | { |
| 0 | 70 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 71 | | { |
| | 72 | | continue; |
| | 73 | | } |
| 0 | 74 | | lastAction = property.Value.GetString().ToRollingUpgradeActionType(); |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("lastActionTime")) |
| | 78 | | { |
| 0 | 79 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 80 | | { |
| | 81 | | continue; |
| | 82 | | } |
| 0 | 83 | | lastActionTime = property.Value.GetDateTimeOffset("O"); |
| | 84 | | continue; |
| | 85 | | } |
| | 86 | | } |
| 0 | 87 | | return new RollingUpgradeRunningStatus(code, startTime, lastAction, lastActionTime); |
| | 88 | | } |
| | 89 | | } |
| | 90 | | } |