| | 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 DataDisk : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 80 | 17 | | writer.WriteStartObject(); |
| 80 | 18 | | writer.WritePropertyName("lun"); |
| 80 | 19 | | writer.WriteNumberValue(Lun); |
| 80 | 20 | | if (Name != null) |
| | 21 | | { |
| 48 | 22 | | writer.WritePropertyName("name"); |
| 48 | 23 | | writer.WriteStringValue(Name); |
| | 24 | | } |
| 80 | 25 | | if (Vhd != null) |
| | 26 | | { |
| 48 | 27 | | writer.WritePropertyName("vhd"); |
| 48 | 28 | | writer.WriteObjectValue(Vhd); |
| | 29 | | } |
| 80 | 30 | | if (Image != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("image"); |
| 0 | 33 | | writer.WriteObjectValue(Image); |
| | 34 | | } |
| 80 | 35 | | if (Caching != null) |
| | 36 | | { |
| 80 | 37 | | writer.WritePropertyName("caching"); |
| 80 | 38 | | writer.WriteStringValue(Caching.Value.ToSerialString()); |
| | 39 | | } |
| 80 | 40 | | if (WriteAcceleratorEnabled != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("writeAcceleratorEnabled"); |
| 0 | 43 | | writer.WriteBooleanValue(WriteAcceleratorEnabled.Value); |
| | 44 | | } |
| 80 | 45 | | writer.WritePropertyName("createOption"); |
| 80 | 46 | | writer.WriteStringValue(CreateOption.ToString()); |
| 80 | 47 | | if (DiskSizeGB != null) |
| | 48 | | { |
| 80 | 49 | | writer.WritePropertyName("diskSizeGB"); |
| 80 | 50 | | writer.WriteNumberValue(DiskSizeGB.Value); |
| | 51 | | } |
| 80 | 52 | | if (ManagedDisk != null) |
| | 53 | | { |
| 32 | 54 | | writer.WritePropertyName("managedDisk"); |
| 32 | 55 | | writer.WriteObjectValue(ManagedDisk); |
| | 56 | | } |
| 80 | 57 | | if (ToBeDetached != null) |
| | 58 | | { |
| 16 | 59 | | writer.WritePropertyName("toBeDetached"); |
| 16 | 60 | | writer.WriteBooleanValue(ToBeDetached.Value); |
| | 61 | | } |
| 80 | 62 | | if (DiskIopsReadWrite != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("diskIOPSReadWrite"); |
| 0 | 65 | | writer.WriteNumberValue(DiskIopsReadWrite.Value); |
| | 66 | | } |
| 80 | 67 | | if (DiskMBpsReadWrite != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("diskMBpsReadWrite"); |
| 0 | 70 | | writer.WriteNumberValue(DiskMBpsReadWrite.Value); |
| | 71 | | } |
| 80 | 72 | | writer.WriteEndObject(); |
| 80 | 73 | | } |
| | 74 | |
|
| | 75 | | internal static DataDisk DeserializeDataDisk(JsonElement element) |
| | 76 | | { |
| 180 | 77 | | int lun = default; |
| 180 | 78 | | string name = default; |
| 180 | 79 | | VirtualHardDisk vhd = default; |
| 180 | 80 | | VirtualHardDisk image = default; |
| 180 | 81 | | CachingTypes? caching = default; |
| 180 | 82 | | bool? writeAcceleratorEnabled = default; |
| 180 | 83 | | DiskCreateOptionTypes createOption = default; |
| 180 | 84 | | int? diskSizeGB = default; |
| 180 | 85 | | ManagedDiskParameters managedDisk = default; |
| 180 | 86 | | bool? toBeDetached = default; |
| 180 | 87 | | long? diskIOPSReadWrite = default; |
| 180 | 88 | | long? diskMBpsReadWrite = default; |
| 2944 | 89 | | foreach (var property in element.EnumerateObject()) |
| | 90 | | { |
| 1292 | 91 | | if (property.NameEquals("lun")) |
| | 92 | | { |
| 180 | 93 | | lun = property.Value.GetInt32(); |
| 180 | 94 | | continue; |
| | 95 | | } |
| 1112 | 96 | | if (property.NameEquals("name")) |
| | 97 | | { |
| 180 | 98 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 99 | | { |
| | 100 | | continue; |
| | 101 | | } |
| 180 | 102 | | name = property.Value.GetString(); |
| 180 | 103 | | continue; |
| | 104 | | } |
| 932 | 105 | | if (property.NameEquals("vhd")) |
| | 106 | | { |
| 48 | 107 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 108 | | { |
| | 109 | | continue; |
| | 110 | | } |
| 48 | 111 | | vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value); |
| 48 | 112 | | continue; |
| | 113 | | } |
| 884 | 114 | | if (property.NameEquals("image")) |
| | 115 | | { |
| 0 | 116 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 117 | | { |
| | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value); |
| 0 | 121 | | continue; |
| | 122 | | } |
| 884 | 123 | | if (property.NameEquals("caching")) |
| | 124 | | { |
| 180 | 125 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| | 127 | | continue; |
| | 128 | | } |
| 180 | 129 | | caching = property.Value.GetString().ToCachingTypes(); |
| 180 | 130 | | continue; |
| | 131 | | } |
| 704 | 132 | | if (property.NameEquals("writeAcceleratorEnabled")) |
| | 133 | | { |
| 0 | 134 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | writeAcceleratorEnabled = property.Value.GetBoolean(); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 704 | 141 | | if (property.NameEquals("createOption")) |
| | 142 | | { |
| 180 | 143 | | createOption = new DiskCreateOptionTypes(property.Value.GetString()); |
| 180 | 144 | | continue; |
| | 145 | | } |
| 524 | 146 | | if (property.NameEquals("diskSizeGB")) |
| | 147 | | { |
| 180 | 148 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 180 | 152 | | diskSizeGB = property.Value.GetInt32(); |
| 180 | 153 | | continue; |
| | 154 | | } |
| 344 | 155 | | if (property.NameEquals("managedDisk")) |
| | 156 | | { |
| 132 | 157 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 132 | 161 | | managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value); |
| 132 | 162 | | continue; |
| | 163 | | } |
| 212 | 164 | | if (property.NameEquals("toBeDetached")) |
| | 165 | | { |
| 180 | 166 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 180 | 170 | | toBeDetached = property.Value.GetBoolean(); |
| 180 | 171 | | continue; |
| | 172 | | } |
| 32 | 173 | | if (property.NameEquals("diskIOPSReadWrite")) |
| | 174 | | { |
| 16 | 175 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 16 | 179 | | diskIOPSReadWrite = property.Value.GetInt64(); |
| 16 | 180 | | continue; |
| | 181 | | } |
| 16 | 182 | | if (property.NameEquals("diskMBpsReadWrite")) |
| | 183 | | { |
| 16 | 184 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 16 | 188 | | diskMBpsReadWrite = property.Value.GetInt64(); |
| | 189 | | continue; |
| | 190 | | } |
| | 191 | | } |
| 180 | 192 | | return new DataDisk(lun, name, vhd, image, caching, writeAcceleratorEnabled, createOption, diskSizeGB, manag |
| | 193 | | } |
| | 194 | | } |
| | 195 | | } |