| | 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.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class RollingUpgradeStatusInfo : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 0 | 24 | | if (Name != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("name"); |
| 0 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("location"); |
| 0 | 35 | | writer.WriteStringValue(Location); |
| 0 | 36 | | if (Tags != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("tags"); |
| 0 | 39 | | writer.WriteStartObject(); |
| 0 | 40 | | foreach (var item in Tags) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName(item.Key); |
| 0 | 43 | | writer.WriteStringValue(item.Value); |
| | 44 | | } |
| 0 | 45 | | writer.WriteEndObject(); |
| | 46 | | } |
| 0 | 47 | | writer.WritePropertyName("properties"); |
| 0 | 48 | | writer.WriteStartObject(); |
| 0 | 49 | | if (Policy != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("policy"); |
| 0 | 52 | | writer.WriteObjectValue(Policy); |
| | 53 | | } |
| 0 | 54 | | if (RunningStatus != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("runningStatus"); |
| 0 | 57 | | writer.WriteObjectValue(RunningStatus); |
| | 58 | | } |
| 0 | 59 | | if (Progress != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("progress"); |
| 0 | 62 | | writer.WriteObjectValue(Progress); |
| | 63 | | } |
| 0 | 64 | | if (Error != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("error"); |
| 0 | 67 | | writer.WriteObjectValue(Error); |
| | 68 | | } |
| 0 | 69 | | writer.WriteEndObject(); |
| 0 | 70 | | writer.WriteEndObject(); |
| 0 | 71 | | } |
| | 72 | |
|
| | 73 | | internal static RollingUpgradeStatusInfo DeserializeRollingUpgradeStatusInfo(JsonElement element) |
| | 74 | | { |
| 0 | 75 | | string id = default; |
| 0 | 76 | | string name = default; |
| 0 | 77 | | string type = default; |
| 0 | 78 | | string location = default; |
| 0 | 79 | | IDictionary<string, string> tags = default; |
| 0 | 80 | | RollingUpgradePolicy policy = default; |
| 0 | 81 | | RollingUpgradeRunningStatus runningStatus = default; |
| 0 | 82 | | RollingUpgradeProgressInfo progress = default; |
| 0 | 83 | | ApiError error = default; |
| 0 | 84 | | foreach (var property in element.EnumerateObject()) |
| | 85 | | { |
| 0 | 86 | | if (property.NameEquals("id")) |
| | 87 | | { |
| 0 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 0 | 92 | | id = property.Value.GetString(); |
| 0 | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | if (property.NameEquals("name")) |
| | 96 | | { |
| 0 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 0 | 101 | | name = property.Value.GetString(); |
| 0 | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | if (property.NameEquals("type")) |
| | 105 | | { |
| 0 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | type = property.Value.GetString(); |
| 0 | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | if (property.NameEquals("location")) |
| | 114 | | { |
| 0 | 115 | | location = property.Value.GetString(); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property.NameEquals("tags")) |
| | 119 | | { |
| 0 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 125 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 126 | | { |
| 0 | 127 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| 0 | 129 | | dictionary.Add(property0.Name, null); |
| | 130 | | } |
| | 131 | | else |
| | 132 | | { |
| 0 | 133 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 134 | | } |
| | 135 | | } |
| 0 | 136 | | tags = dictionary; |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property.NameEquals("properties")) |
| | 140 | | { |
| 0 | 141 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 142 | | { |
| 0 | 143 | | if (property0.NameEquals("policy")) |
| | 144 | | { |
| 0 | 145 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | policy = RollingUpgradePolicy.DeserializeRollingUpgradePolicy(property0.Value); |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property0.NameEquals("runningStatus")) |
| | 153 | | { |
| 0 | 154 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | runningStatus = RollingUpgradeRunningStatus.DeserializeRollingUpgradeRunningStatus(property0 |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property0.NameEquals("progress")) |
| | 162 | | { |
| 0 | 163 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | progress = RollingUpgradeProgressInfo.DeserializeRollingUpgradeProgressInfo(property0.Value) |
| 0 | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | if (property0.NameEquals("error")) |
| | 171 | | { |
| 0 | 172 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | error = ApiError.DeserializeApiError(property0.Value); |
| | 177 | | continue; |
| | 178 | | } |
| | 179 | | } |
| | 180 | | continue; |
| | 181 | | } |
| | 182 | | } |
| 0 | 183 | | return new RollingUpgradeStatusInfo(id, name, type, location, tags, policy, runningStatus, progress, error); |
| | 184 | | } |
| | 185 | | } |
| | 186 | | } |