| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Compute.Models |
| | 12 | | { |
| | 13 | | public partial class OSDisk : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 244 | 17 | | writer.WriteStartObject(); |
| 244 | 18 | | if (OsType != null) |
| | 19 | | { |
| 16 | 20 | | writer.WritePropertyName("osType"); |
| 16 | 21 | | writer.WriteStringValue(OsType.Value.ToSerialString()); |
| | 22 | | } |
| 244 | 23 | | if (EncryptionSettings != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("encryptionSettings"); |
| 0 | 26 | | writer.WriteObjectValue(EncryptionSettings); |
| | 27 | | } |
| 244 | 28 | | if (Name != null) |
| | 29 | | { |
| 244 | 30 | | writer.WritePropertyName("name"); |
| 244 | 31 | | writer.WriteStringValue(Name); |
| | 32 | | } |
| 244 | 33 | | if (Vhd != null) |
| | 34 | | { |
| 212 | 35 | | writer.WritePropertyName("vhd"); |
| 212 | 36 | | writer.WriteObjectValue(Vhd); |
| | 37 | | } |
| 244 | 38 | | if (Image != null) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("image"); |
| 0 | 41 | | writer.WriteObjectValue(Image); |
| | 42 | | } |
| 244 | 43 | | if (Caching != null) |
| | 44 | | { |
| 244 | 45 | | writer.WritePropertyName("caching"); |
| 244 | 46 | | writer.WriteStringValue(Caching.Value.ToSerialString()); |
| | 47 | | } |
| 244 | 48 | | if (WriteAcceleratorEnabled != null) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName("writeAcceleratorEnabled"); |
| 0 | 51 | | writer.WriteBooleanValue(WriteAcceleratorEnabled.Value); |
| | 52 | | } |
| 244 | 53 | | if (DiffDiskSettings != null) |
| | 54 | | { |
| 8 | 55 | | writer.WritePropertyName("diffDiskSettings"); |
| 8 | 56 | | writer.WriteObjectValue(DiffDiskSettings); |
| | 57 | | } |
| 244 | 58 | | writer.WritePropertyName("createOption"); |
| 244 | 59 | | writer.WriteStringValue(CreateOption.ToString()); |
| 244 | 60 | | if (DiskSizeGB != null) |
| | 61 | | { |
| 24 | 62 | | writer.WritePropertyName("diskSizeGB"); |
| 24 | 63 | | writer.WriteNumberValue(DiskSizeGB.Value); |
| | 64 | | } |
| 244 | 65 | | if (ManagedDisk != null) |
| | 66 | | { |
| 32 | 67 | | writer.WritePropertyName("managedDisk"); |
| 32 | 68 | | writer.WriteObjectValue(ManagedDisk); |
| | 69 | | } |
| 244 | 70 | | writer.WriteEndObject(); |
| 244 | 71 | | } |
| | 72 | |
|
| | 73 | | internal static OSDisk DeserializeOSDisk(JsonElement element) |
| | 74 | | { |
| 432 | 75 | | OperatingSystemTypes? osType = default; |
| 432 | 76 | | DiskEncryptionSettings encryptionSettings = default; |
| 432 | 77 | | string name = default; |
| 432 | 78 | | VirtualHardDisk vhd = default; |
| 432 | 79 | | VirtualHardDisk image = default; |
| 432 | 80 | | CachingTypes? caching = default; |
| 432 | 81 | | bool? writeAcceleratorEnabled = default; |
| 432 | 82 | | DiffDiskSettings diffDiskSettings = default; |
| 432 | 83 | | DiskCreateOptionTypes createOption = default; |
| 432 | 84 | | int? diskSizeGB = default; |
| 432 | 85 | | ManagedDiskParameters managedDisk = default; |
| 6016 | 86 | | foreach (var property in element.EnumerateObject()) |
| | 87 | | { |
| 2576 | 88 | | if (property.NameEquals("osType")) |
| | 89 | | { |
| 432 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 432 | 94 | | osType = property.Value.GetString().ToOperatingSystemTypes(); |
| 432 | 95 | | continue; |
| | 96 | | } |
| 2144 | 97 | | if (property.NameEquals("encryptionSettings")) |
| | 98 | | { |
| 0 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | encryptionSettings = DiskEncryptionSettings.DeserializeDiskEncryptionSettings(property.Value); |
| 0 | 104 | | continue; |
| | 105 | | } |
| 2144 | 106 | | if (property.NameEquals("name")) |
| | 107 | | { |
| 432 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 432 | 112 | | name = property.Value.GetString(); |
| 432 | 113 | | continue; |
| | 114 | | } |
| 1712 | 115 | | if (property.NameEquals("vhd")) |
| | 116 | | { |
| 300 | 117 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 118 | | { |
| | 119 | | continue; |
| | 120 | | } |
| 300 | 121 | | vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value); |
| 300 | 122 | | continue; |
| | 123 | | } |
| 1412 | 124 | | if (property.NameEquals("image")) |
| | 125 | | { |
| 0 | 126 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| | 128 | | continue; |
| | 129 | | } |
| 0 | 130 | | image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value); |
| 0 | 131 | | continue; |
| | 132 | | } |
| 1412 | 133 | | if (property.NameEquals("caching")) |
| | 134 | | { |
| 432 | 135 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 136 | | { |
| | 137 | | continue; |
| | 138 | | } |
| 432 | 139 | | caching = property.Value.GetString().ToCachingTypes(); |
| 432 | 140 | | continue; |
| | 141 | | } |
| 980 | 142 | | if (property.NameEquals("writeAcceleratorEnabled")) |
| | 143 | | { |
| 0 | 144 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 145 | | { |
| | 146 | | continue; |
| | 147 | | } |
| 0 | 148 | | writeAcceleratorEnabled = property.Value.GetBoolean(); |
| 0 | 149 | | continue; |
| | 150 | | } |
| 980 | 151 | | if (property.NameEquals("diffDiskSettings")) |
| | 152 | | { |
| 16 | 153 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 154 | | { |
| | 155 | | continue; |
| | 156 | | } |
| 16 | 157 | | diffDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value); |
| 16 | 158 | | continue; |
| | 159 | | } |
| 964 | 160 | | if (property.NameEquals("createOption")) |
| | 161 | | { |
| 432 | 162 | | createOption = new DiskCreateOptionTypes(property.Value.GetString()); |
| 432 | 163 | | continue; |
| | 164 | | } |
| 532 | 165 | | if (property.NameEquals("diskSizeGB")) |
| | 166 | | { |
| 400 | 167 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 400 | 171 | | diskSizeGB = property.Value.GetInt32(); |
| 400 | 172 | | continue; |
| | 173 | | } |
| 132 | 174 | | if (property.NameEquals("managedDisk")) |
| | 175 | | { |
| 132 | 176 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 132 | 180 | | managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value); |
| | 181 | | continue; |
| | 182 | | } |
| | 183 | | } |
| 432 | 184 | | return new OSDisk(osType, encryptionSettings, name, vhd, image, caching, writeAcceleratorEnabled, diffDiskSe |
| | 185 | | } |
| | 186 | | } |
| | 187 | | } |