| | 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 VirtualMachineScaleSetDataDisk : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 248 | 17 | | writer.WriteStartObject(); |
| 248 | 18 | | if (Name != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 248 | 23 | | writer.WritePropertyName("lun"); |
| 248 | 24 | | writer.WriteNumberValue(Lun); |
| 248 | 25 | | if (Caching != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("caching"); |
| 0 | 28 | | writer.WriteStringValue(Caching.Value.ToSerialString()); |
| | 29 | | } |
| 248 | 30 | | if (WriteAcceleratorEnabled != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("writeAcceleratorEnabled"); |
| 0 | 33 | | writer.WriteBooleanValue(WriteAcceleratorEnabled.Value); |
| | 34 | | } |
| 248 | 35 | | writer.WritePropertyName("createOption"); |
| 248 | 36 | | writer.WriteStringValue(CreateOption.ToString()); |
| 248 | 37 | | if (DiskSizeGB != null) |
| | 38 | | { |
| 248 | 39 | | writer.WritePropertyName("diskSizeGB"); |
| 248 | 40 | | writer.WriteNumberValue(DiskSizeGB.Value); |
| | 41 | | } |
| 248 | 42 | | if (ManagedDisk != null) |
| | 43 | | { |
| 8 | 44 | | writer.WritePropertyName("managedDisk"); |
| 8 | 45 | | writer.WriteObjectValue(ManagedDisk); |
| | 46 | | } |
| 248 | 47 | | if (DiskIopsReadWrite != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("diskIOPSReadWrite"); |
| 0 | 50 | | writer.WriteNumberValue(DiskIopsReadWrite.Value); |
| | 51 | | } |
| 248 | 52 | | if (DiskMBpsReadWrite != null) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("diskMBpsReadWrite"); |
| 0 | 55 | | writer.WriteNumberValue(DiskMBpsReadWrite.Value); |
| | 56 | | } |
| 248 | 57 | | writer.WriteEndObject(); |
| 248 | 58 | | } |
| | 59 | |
|
| | 60 | | internal static VirtualMachineScaleSetDataDisk DeserializeVirtualMachineScaleSetDataDisk(JsonElement element) |
| | 61 | | { |
| 300 | 62 | | string name = default; |
| 300 | 63 | | int lun = default; |
| 300 | 64 | | CachingTypes? caching = default; |
| 300 | 65 | | bool? writeAcceleratorEnabled = default; |
| 300 | 66 | | DiskCreateOptionTypes createOption = default; |
| 300 | 67 | | int? diskSizeGB = default; |
| 300 | 68 | | VirtualMachineScaleSetManagedDiskParameters managedDisk = default; |
| 300 | 69 | | long? diskIOPSReadWrite = default; |
| 300 | 70 | | long? diskMBpsReadWrite = default; |
| 3648 | 71 | | foreach (var property in element.EnumerateObject()) |
| | 72 | | { |
| 1524 | 73 | | if (property.NameEquals("name")) |
| | 74 | | { |
| 0 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 76 | | { |
| | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | name = property.Value.GetString(); |
| 0 | 80 | | continue; |
| | 81 | | } |
| 1524 | 82 | | if (property.NameEquals("lun")) |
| | 83 | | { |
| 300 | 84 | | lun = property.Value.GetInt32(); |
| 300 | 85 | | continue; |
| | 86 | | } |
| 1224 | 87 | | if (property.NameEquals("caching")) |
| | 88 | | { |
| 300 | 89 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 90 | | { |
| | 91 | | continue; |
| | 92 | | } |
| 300 | 93 | | caching = property.Value.GetString().ToCachingTypes(); |
| 300 | 94 | | continue; |
| | 95 | | } |
| 924 | 96 | | if (property.NameEquals("writeAcceleratorEnabled")) |
| | 97 | | { |
| 0 | 98 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 99 | | { |
| | 100 | | continue; |
| | 101 | | } |
| 0 | 102 | | writeAcceleratorEnabled = property.Value.GetBoolean(); |
| 0 | 103 | | continue; |
| | 104 | | } |
| 924 | 105 | | if (property.NameEquals("createOption")) |
| | 106 | | { |
| 300 | 107 | | createOption = new DiskCreateOptionTypes(property.Value.GetString()); |
| 300 | 108 | | continue; |
| | 109 | | } |
| 624 | 110 | | if (property.NameEquals("diskSizeGB")) |
| | 111 | | { |
| 300 | 112 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 113 | | { |
| | 114 | | continue; |
| | 115 | | } |
| 300 | 116 | | diskSizeGB = property.Value.GetInt32(); |
| 300 | 117 | | continue; |
| | 118 | | } |
| 324 | 119 | | if (property.NameEquals("managedDisk")) |
| | 120 | | { |
| 300 | 121 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| | 123 | | continue; |
| | 124 | | } |
| 300 | 125 | | managedDisk = VirtualMachineScaleSetManagedDiskParameters.DeserializeVirtualMachineScaleSetManagedDi |
| 300 | 126 | | continue; |
| | 127 | | } |
| 24 | 128 | | if (property.NameEquals("diskIOPSReadWrite")) |
| | 129 | | { |
| 12 | 130 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 12 | 134 | | diskIOPSReadWrite = property.Value.GetInt64(); |
| 12 | 135 | | continue; |
| | 136 | | } |
| 12 | 137 | | if (property.NameEquals("diskMBpsReadWrite")) |
| | 138 | | { |
| 12 | 139 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 12 | 143 | | diskMBpsReadWrite = property.Value.GetInt64(); |
| | 144 | | continue; |
| | 145 | | } |
| | 146 | | } |
| 300 | 147 | | return new VirtualMachineScaleSetDataDisk(name, lun, caching, writeAcceleratorEnabled, createOption, diskSiz |
| | 148 | | } |
| | 149 | | } |
| | 150 | | } |