| | 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 MaintenanceRedeployStatus : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (IsCustomerInitiatedMaintenanceAllowed != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("isCustomerInitiatedMaintenanceAllowed"); |
| 0 | 22 | | writer.WriteBooleanValue(IsCustomerInitiatedMaintenanceAllowed.Value); |
| | 23 | | } |
| 0 | 24 | | if (PreMaintenanceWindowStartTime != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("preMaintenanceWindowStartTime"); |
| 0 | 27 | | writer.WriteStringValue(PreMaintenanceWindowStartTime.Value, "O"); |
| | 28 | | } |
| 0 | 29 | | if (PreMaintenanceWindowEndTime != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("preMaintenanceWindowEndTime"); |
| 0 | 32 | | writer.WriteStringValue(PreMaintenanceWindowEndTime.Value, "O"); |
| | 33 | | } |
| 0 | 34 | | if (MaintenanceWindowStartTime != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("maintenanceWindowStartTime"); |
| 0 | 37 | | writer.WriteStringValue(MaintenanceWindowStartTime.Value, "O"); |
| | 38 | | } |
| 0 | 39 | | if (MaintenanceWindowEndTime != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("maintenanceWindowEndTime"); |
| 0 | 42 | | writer.WriteStringValue(MaintenanceWindowEndTime.Value, "O"); |
| | 43 | | } |
| 0 | 44 | | if (LastOperationResultCode != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("lastOperationResultCode"); |
| 0 | 47 | | writer.WriteStringValue(LastOperationResultCode.Value.ToSerialString()); |
| | 48 | | } |
| 0 | 49 | | if (LastOperationMessage != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("lastOperationMessage"); |
| 0 | 52 | | writer.WriteStringValue(LastOperationMessage); |
| | 53 | | } |
| 0 | 54 | | writer.WriteEndObject(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | internal static MaintenanceRedeployStatus DeserializeMaintenanceRedeployStatus(JsonElement element) |
| | 58 | | { |
| 0 | 59 | | bool? isCustomerInitiatedMaintenanceAllowed = default; |
| 0 | 60 | | DateTimeOffset? preMaintenanceWindowStartTime = default; |
| 0 | 61 | | DateTimeOffset? preMaintenanceWindowEndTime = default; |
| 0 | 62 | | DateTimeOffset? maintenanceWindowStartTime = default; |
| 0 | 63 | | DateTimeOffset? maintenanceWindowEndTime = default; |
| 0 | 64 | | MaintenanceOperationResultCodeTypes? lastOperationResultCode = default; |
| 0 | 65 | | string lastOperationMessage = default; |
| 0 | 66 | | foreach (var property in element.EnumerateObject()) |
| | 67 | | { |
| 0 | 68 | | if (property.NameEquals("isCustomerInitiatedMaintenanceAllowed")) |
| | 69 | | { |
| 0 | 70 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 71 | | { |
| | 72 | | continue; |
| | 73 | | } |
| 0 | 74 | | isCustomerInitiatedMaintenanceAllowed = property.Value.GetBoolean(); |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("preMaintenanceWindowStartTime")) |
| | 78 | | { |
| 0 | 79 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 80 | | { |
| | 81 | | continue; |
| | 82 | | } |
| 0 | 83 | | preMaintenanceWindowStartTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property.NameEquals("preMaintenanceWindowEndTime")) |
| | 87 | | { |
| 0 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 0 | 92 | | preMaintenanceWindowEndTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | if (property.NameEquals("maintenanceWindowStartTime")) |
| | 96 | | { |
| 0 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 0 | 101 | | maintenanceWindowStartTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | if (property.NameEquals("maintenanceWindowEndTime")) |
| | 105 | | { |
| 0 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | maintenanceWindowEndTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | if (property.NameEquals("lastOperationResultCode")) |
| | 114 | | { |
| 0 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | lastOperationResultCode = property.Value.GetString().ToMaintenanceOperationResultCodeTypes(); |
| 0 | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | if (property.NameEquals("lastOperationMessage")) |
| | 123 | | { |
| 0 | 124 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | lastOperationMessage = property.Value.GetString(); |
| | 129 | | continue; |
| | 130 | | } |
| | 131 | | } |
| 0 | 132 | | return new MaintenanceRedeployStatus(isCustomerInitiatedMaintenanceAllowed, preMaintenanceWindowStartTime, p |
| | 133 | | } |
| | 134 | | } |
| | 135 | | } |