| | 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 ManagedDiskParameters : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 64 | 17 | | writer.WriteStartObject(); |
| 64 | 18 | | if (StorageAccountType != null) |
| | 19 | | { |
| 64 | 20 | | writer.WritePropertyName("storageAccountType"); |
| 64 | 21 | | writer.WriteStringValue(StorageAccountType.Value.ToString()); |
| | 22 | | } |
| 64 | 23 | | if (DiskEncryptionSet != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("diskEncryptionSet"); |
| 0 | 26 | | writer.WriteObjectValue(DiskEncryptionSet); |
| | 27 | | } |
| 64 | 28 | | if (Id != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("id"); |
| 0 | 31 | | writer.WriteStringValue(Id); |
| | 32 | | } |
| 64 | 33 | | writer.WriteEndObject(); |
| 64 | 34 | | } |
| | 35 | |
|
| | 36 | | internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonElement element) |
| | 37 | | { |
| 264 | 38 | | StorageAccountTypes? storageAccountType = default; |
| 264 | 39 | | SubResource diskEncryptionSet = default; |
| 264 | 40 | | string id = default; |
| 1584 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 528 | 43 | | if (property.NameEquals("storageAccountType")) |
| | 44 | | { |
| 264 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 264 | 49 | | storageAccountType = new StorageAccountTypes(property.Value.GetString()); |
| 264 | 50 | | continue; |
| | 51 | | } |
| 264 | 52 | | if (property.NameEquals("diskEncryptionSet")) |
| | 53 | | { |
| 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | diskEncryptionSet = DeserializeSubResource(property.Value); |
| 0 | 59 | | continue; |
| | 60 | | } |
| 264 | 61 | | if (property.NameEquals("id")) |
| | 62 | | { |
| 264 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 264 | 67 | | id = property.Value.GetString(); |
| | 68 | | continue; |
| | 69 | | } |
| | 70 | | } |
| 264 | 71 | | return new ManagedDiskParameters(id, storageAccountType, diskEncryptionSet); |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |