| | 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 ImageDataDisk : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 8 | 17 | | writer.WriteStartObject(); |
| 8 | 18 | | writer.WritePropertyName("lun"); |
| 8 | 19 | | writer.WriteNumberValue(Lun); |
| 8 | 20 | | if (Snapshot != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("snapshot"); |
| 0 | 23 | | writer.WriteObjectValue(Snapshot); |
| | 24 | | } |
| 8 | 25 | | if (ManagedDisk != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("managedDisk"); |
| 0 | 28 | | writer.WriteObjectValue(ManagedDisk); |
| | 29 | | } |
| 8 | 30 | | if (BlobUri != null) |
| | 31 | | { |
| 8 | 32 | | writer.WritePropertyName("blobUri"); |
| 8 | 33 | | writer.WriteStringValue(BlobUri); |
| | 34 | | } |
| 8 | 35 | | if (Caching != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("caching"); |
| 0 | 38 | | writer.WriteStringValue(Caching.Value.ToSerialString()); |
| | 39 | | } |
| 8 | 40 | | if (DiskSizeGB != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("diskSizeGB"); |
| 0 | 43 | | writer.WriteNumberValue(DiskSizeGB.Value); |
| | 44 | | } |
| 8 | 45 | | if (StorageAccountType != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("storageAccountType"); |
| 0 | 48 | | writer.WriteStringValue(StorageAccountType.Value.ToString()); |
| | 49 | | } |
| 8 | 50 | | if (DiskEncryptionSet != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("diskEncryptionSet"); |
| 0 | 53 | | writer.WriteObjectValue(DiskEncryptionSet); |
| | 54 | | } |
| 8 | 55 | | writer.WriteEndObject(); |
| 8 | 56 | | } |
| | 57 | |
|
| | 58 | | internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) |
| | 59 | | { |
| 16 | 60 | | int lun = default; |
| 16 | 61 | | SubResource snapshot = default; |
| 16 | 62 | | SubResource managedDisk = default; |
| 16 | 63 | | string blobUri = default; |
| 16 | 64 | | CachingTypes? caching = default; |
| 16 | 65 | | int? diskSizeGB = default; |
| 16 | 66 | | StorageAccountTypes? storageAccountType = default; |
| 16 | 67 | | SubResource diskEncryptionSet = default; |
| 192 | 68 | | foreach (var property in element.EnumerateObject()) |
| | 69 | | { |
| 80 | 70 | | if (property.NameEquals("lun")) |
| | 71 | | { |
| 16 | 72 | | lun = property.Value.GetInt32(); |
| 16 | 73 | | continue; |
| | 74 | | } |
| 64 | 75 | | if (property.NameEquals("snapshot")) |
| | 76 | | { |
| 0 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | snapshot = SubResource.DeserializeSubResource(property.Value); |
| 0 | 82 | | continue; |
| | 83 | | } |
| 64 | 84 | | if (property.NameEquals("managedDisk")) |
| | 85 | | { |
| 0 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | managedDisk = SubResource.DeserializeSubResource(property.Value); |
| 0 | 91 | | continue; |
| | 92 | | } |
| 64 | 93 | | if (property.NameEquals("blobUri")) |
| | 94 | | { |
| 16 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| | 97 | | continue; |
| | 98 | | } |
| 16 | 99 | | blobUri = property.Value.GetString(); |
| 16 | 100 | | continue; |
| | 101 | | } |
| 48 | 102 | | if (property.NameEquals("caching")) |
| | 103 | | { |
| 16 | 104 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 105 | | { |
| | 106 | | continue; |
| | 107 | | } |
| 16 | 108 | | caching = property.Value.GetString().ToCachingTypes(); |
| 16 | 109 | | continue; |
| | 110 | | } |
| 32 | 111 | | if (property.NameEquals("diskSizeGB")) |
| | 112 | | { |
| 16 | 113 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 114 | | { |
| | 115 | | continue; |
| | 116 | | } |
| 16 | 117 | | diskSizeGB = property.Value.GetInt32(); |
| 16 | 118 | | continue; |
| | 119 | | } |
| 16 | 120 | | if (property.NameEquals("storageAccountType")) |
| | 121 | | { |
| 16 | 122 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| | 124 | | continue; |
| | 125 | | } |
| 16 | 126 | | storageAccountType = new StorageAccountTypes(property.Value.GetString()); |
| 16 | 127 | | continue; |
| | 128 | | } |
| 0 | 129 | | if (property.NameEquals("diskEncryptionSet")) |
| | 130 | | { |
| 0 | 131 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 132 | | { |
| | 133 | | continue; |
| | 134 | | } |
| 0 | 135 | | diskEncryptionSet = SubResource.DeserializeSubResource(property.Value); |
| | 136 | | continue; |
| | 137 | | } |
| | 138 | | } |
| 16 | 139 | | return new ImageDataDisk(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryp |
| | 140 | | } |
| | 141 | | } |
| | 142 | | } |