| | 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 VirtualMachineScaleSetVMInstanceView : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (PlatformUpdateDomain != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("platformUpdateDomain"); |
| 0 | 22 | | writer.WriteNumberValue(PlatformUpdateDomain.Value); |
| | 23 | | } |
| 0 | 24 | | if (PlatformFaultDomain != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("platformFaultDomain"); |
| 0 | 27 | | writer.WriteNumberValue(PlatformFaultDomain.Value); |
| | 28 | | } |
| 0 | 29 | | if (RdpThumbPrint != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("rdpThumbPrint"); |
| 0 | 32 | | writer.WriteStringValue(RdpThumbPrint); |
| | 33 | | } |
| 0 | 34 | | if (VmAgent != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("vmAgent"); |
| 0 | 37 | | writer.WriteObjectValue(VmAgent); |
| | 38 | | } |
| 0 | 39 | | if (MaintenanceRedeployStatus != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("maintenanceRedeployStatus"); |
| 0 | 42 | | writer.WriteObjectValue(MaintenanceRedeployStatus); |
| | 43 | | } |
| 0 | 44 | | if (Disks != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("disks"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in Disks) |
| | 49 | | { |
| 0 | 50 | | writer.WriteObjectValue(item); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | if (Extensions != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("extensions"); |
| 0 | 57 | | writer.WriteStartArray(); |
| 0 | 58 | | foreach (var item in Extensions) |
| | 59 | | { |
| 0 | 60 | | writer.WriteObjectValue(item); |
| | 61 | | } |
| 0 | 62 | | writer.WriteEndArray(); |
| | 63 | | } |
| 0 | 64 | | if (VmHealth != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("vmHealth"); |
| 0 | 67 | | writer.WriteObjectValue(VmHealth); |
| | 68 | | } |
| 0 | 69 | | if (BootDiagnostics != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("bootDiagnostics"); |
| 0 | 72 | | writer.WriteObjectValue(BootDiagnostics); |
| | 73 | | } |
| 0 | 74 | | if (Statuses != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("statuses"); |
| 0 | 77 | | writer.WriteStartArray(); |
| 0 | 78 | | foreach (var item in Statuses) |
| | 79 | | { |
| 0 | 80 | | writer.WriteObjectValue(item); |
| | 81 | | } |
| 0 | 82 | | writer.WriteEndArray(); |
| | 83 | | } |
| 0 | 84 | | if (PlacementGroupId != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("placementGroupId"); |
| 0 | 87 | | writer.WriteStringValue(PlacementGroupId); |
| | 88 | | } |
| 0 | 89 | | writer.WriteEndObject(); |
| 0 | 90 | | } |
| | 91 | |
|
| | 92 | | internal static VirtualMachineScaleSetVMInstanceView DeserializeVirtualMachineScaleSetVMInstanceView(JsonElement |
| | 93 | | { |
| 24 | 94 | | int? platformUpdateDomain = default; |
| 24 | 95 | | int? platformFaultDomain = default; |
| 24 | 96 | | string rdpThumbPrint = default; |
| 24 | 97 | | VirtualMachineAgentInstanceView vmAgent = default; |
| 24 | 98 | | MaintenanceRedeployStatus maintenanceRedeployStatus = default; |
| 24 | 99 | | IList<DiskInstanceView> disks = default; |
| 24 | 100 | | IList<VirtualMachineExtensionInstanceView> extensions = default; |
| 24 | 101 | | VirtualMachineHealthStatus vmHealth = default; |
| 24 | 102 | | BootDiagnosticsInstanceView bootDiagnostics = default; |
| 24 | 103 | | IList<InstanceViewStatus> statuses = default; |
| 24 | 104 | | string placementGroupId = default; |
| 576 | 105 | | foreach (var property in element.EnumerateObject()) |
| | 106 | | { |
| 264 | 107 | | if (property.NameEquals("platformUpdateDomain")) |
| | 108 | | { |
| 24 | 109 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 110 | | { |
| | 111 | | continue; |
| | 112 | | } |
| 24 | 113 | | platformUpdateDomain = property.Value.GetInt32(); |
| 24 | 114 | | continue; |
| | 115 | | } |
| 240 | 116 | | if (property.NameEquals("platformFaultDomain")) |
| | 117 | | { |
| 24 | 118 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 24 | 122 | | platformFaultDomain = property.Value.GetInt32(); |
| 24 | 123 | | continue; |
| | 124 | | } |
| 216 | 125 | | if (property.NameEquals("rdpThumbPrint")) |
| | 126 | | { |
| 0 | 127 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | rdpThumbPrint = property.Value.GetString(); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 216 | 134 | | if (property.NameEquals("vmAgent")) |
| | 135 | | { |
| 24 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 24 | 140 | | vmAgent = VirtualMachineAgentInstanceView.DeserializeVirtualMachineAgentInstanceView(property.Value) |
| 24 | 141 | | continue; |
| | 142 | | } |
| 192 | 143 | | if (property.NameEquals("maintenanceRedeployStatus")) |
| | 144 | | { |
| 0 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | maintenanceRedeployStatus = MaintenanceRedeployStatus.DeserializeMaintenanceRedeployStatus(property. |
| 0 | 150 | | continue; |
| | 151 | | } |
| 192 | 152 | | if (property.NameEquals("disks")) |
| | 153 | | { |
| 24 | 154 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 24 | 158 | | List<DiskInstanceView> array = new List<DiskInstanceView>(); |
| 120 | 159 | | foreach (var item in property.Value.EnumerateArray()) |
| | 160 | | { |
| 36 | 161 | | if (item.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| 0 | 163 | | array.Add(null); |
| | 164 | | } |
| | 165 | | else |
| | 166 | | { |
| 36 | 167 | | array.Add(DiskInstanceView.DeserializeDiskInstanceView(item)); |
| | 168 | | } |
| | 169 | | } |
| 24 | 170 | | disks = array; |
| 24 | 171 | | continue; |
| | 172 | | } |
| 168 | 173 | | if (property.NameEquals("extensions")) |
| | 174 | | { |
| 24 | 175 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 24 | 179 | | List<VirtualMachineExtensionInstanceView> array = new List<VirtualMachineExtensionInstanceView>(); |
| 96 | 180 | | foreach (var item in property.Value.EnumerateArray()) |
| | 181 | | { |
| 24 | 182 | | if (item.ValueKind == JsonValueKind.Null) |
| | 183 | | { |
| 0 | 184 | | array.Add(null); |
| | 185 | | } |
| | 186 | | else |
| | 187 | | { |
| 24 | 188 | | array.Add(VirtualMachineExtensionInstanceView.DeserializeVirtualMachineExtensionInstanceView |
| | 189 | | } |
| | 190 | | } |
| 24 | 191 | | extensions = array; |
| 24 | 192 | | continue; |
| | 193 | | } |
| 144 | 194 | | if (property.NameEquals("vmHealth")) |
| | 195 | | { |
| 0 | 196 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 197 | | { |
| | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | vmHealth = VirtualMachineHealthStatus.DeserializeVirtualMachineHealthStatus(property.Value); |
| 0 | 201 | | continue; |
| | 202 | | } |
| 144 | 203 | | if (property.NameEquals("bootDiagnostics")) |
| | 204 | | { |
| 0 | 205 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 206 | | { |
| | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | bootDiagnostics = BootDiagnosticsInstanceView.DeserializeBootDiagnosticsInstanceView(property.Value) |
| 0 | 210 | | continue; |
| | 211 | | } |
| 144 | 212 | | if (property.NameEquals("statuses")) |
| | 213 | | { |
| 24 | 214 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 215 | | { |
| | 216 | | continue; |
| | 217 | | } |
| 24 | 218 | | List<InstanceViewStatus> array = new List<InstanceViewStatus>(); |
| 144 | 219 | | foreach (var item in property.Value.EnumerateArray()) |
| | 220 | | { |
| 48 | 221 | | if (item.ValueKind == JsonValueKind.Null) |
| | 222 | | { |
| 0 | 223 | | array.Add(null); |
| | 224 | | } |
| | 225 | | else |
| | 226 | | { |
| 48 | 227 | | array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item)); |
| | 228 | | } |
| | 229 | | } |
| 24 | 230 | | statuses = array; |
| 24 | 231 | | continue; |
| | 232 | | } |
| 120 | 233 | | if (property.NameEquals("placementGroupId")) |
| | 234 | | { |
| 24 | 235 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 236 | | { |
| | 237 | | continue; |
| | 238 | | } |
| 24 | 239 | | placementGroupId = property.Value.GetString(); |
| | 240 | | continue; |
| | 241 | | } |
| | 242 | | } |
| 24 | 243 | | return new VirtualMachineScaleSetVMInstanceView(platformUpdateDomain, platformFaultDomain, rdpThumbPrint, vm |
| | 244 | | } |
| | 245 | | } |
| | 246 | | } |