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