| | 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 DiskEncryptionSettings : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (DiskEncryptionKey != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("diskEncryptionKey"); |
| 0 | 21 | | writer.WriteObjectValue(DiskEncryptionKey); |
| | 22 | | } |
| 0 | 23 | | if (KeyEncryptionKey != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("keyEncryptionKey"); |
| 0 | 26 | | writer.WriteObjectValue(KeyEncryptionKey); |
| | 27 | | } |
| 0 | 28 | | if (Enabled != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("enabled"); |
| 0 | 31 | | writer.WriteBooleanValue(Enabled.Value); |
| | 32 | | } |
| 0 | 33 | | writer.WriteEndObject(); |
| 0 | 34 | | } |
| | 35 | |
|
| | 36 | | internal static DiskEncryptionSettings DeserializeDiskEncryptionSettings(JsonElement element) |
| | 37 | | { |
| 0 | 38 | | KeyVaultSecretReference diskEncryptionKey = default; |
| 0 | 39 | | KeyVaultKeyReference keyEncryptionKey = default; |
| 0 | 40 | | bool? enabled = default; |
| 0 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 0 | 43 | | if (property.NameEquals("diskEncryptionKey")) |
| | 44 | | { |
| 0 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | diskEncryptionKey = KeyVaultSecretReference.DeserializeKeyVaultSecretReference(property.Value); |
| 0 | 50 | | continue; |
| | 51 | | } |
| 0 | 52 | | if (property.NameEquals("keyEncryptionKey")) |
| | 53 | | { |
| 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | keyEncryptionKey = KeyVaultKeyReference.DeserializeKeyVaultKeyReference(property.Value); |
| 0 | 59 | | continue; |
| | 60 | | } |
| 0 | 61 | | if (property.NameEquals("enabled")) |
| | 62 | | { |
| 0 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | enabled = property.Value.GetBoolean(); |
| | 68 | | continue; |
| | 69 | | } |
| | 70 | | } |
| 0 | 71 | | return new DiskEncryptionSettings(diskEncryptionKey, keyEncryptionKey, enabled); |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |