| | 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.Storage.Models |
| | 12 | | { |
| | 13 | | public partial class Encryption : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 48 | 17 | | writer.WriteStartObject(); |
| 48 | 18 | | if (Services != null) |
| | 19 | | { |
| 48 | 20 | | writer.WritePropertyName("services"); |
| 48 | 21 | | writer.WriteObjectValue(Services); |
| | 22 | | } |
| 48 | 23 | | writer.WritePropertyName("keySource"); |
| 48 | 24 | | writer.WriteStringValue(KeySource.ToString()); |
| 48 | 25 | | if (RequireInfrastructureEncryption != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("requireInfrastructureEncryption"); |
| 0 | 28 | | writer.WriteBooleanValue(RequireInfrastructureEncryption.Value); |
| | 29 | | } |
| 48 | 30 | | if (KeyVaultProperties != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("keyvaultproperties"); |
| 0 | 33 | | writer.WriteObjectValue(KeyVaultProperties); |
| | 34 | | } |
| 48 | 35 | | writer.WriteEndObject(); |
| 48 | 36 | | } |
| | 37 | |
|
| | 38 | | internal static Encryption DeserializeEncryption(JsonElement element) |
| | 39 | | { |
| 836 | 40 | | EncryptionServices services = default; |
| 836 | 41 | | KeySource keySource = default; |
| 836 | 42 | | bool? requireInfrastructureEncryption = default; |
| 836 | 43 | | KeyVaultProperties keyvaultproperties = default; |
| 5056 | 44 | | foreach (var property in element.EnumerateObject()) |
| | 45 | | { |
| 1692 | 46 | | if (property.NameEquals("services")) |
| | 47 | | { |
| 836 | 48 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 49 | | { |
| | 50 | | continue; |
| | 51 | | } |
| 836 | 52 | | services = EncryptionServices.DeserializeEncryptionServices(property.Value); |
| 836 | 53 | | continue; |
| | 54 | | } |
| 856 | 55 | | if (property.NameEquals("keySource")) |
| | 56 | | { |
| 836 | 57 | | keySource = new KeySource(property.Value.GetString()); |
| 836 | 58 | | continue; |
| | 59 | | } |
| 20 | 60 | | if (property.NameEquals("requireInfrastructureEncryption")) |
| | 61 | | { |
| 12 | 62 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 63 | | { |
| | 64 | | continue; |
| | 65 | | } |
| 12 | 66 | | requireInfrastructureEncryption = property.Value.GetBoolean(); |
| 12 | 67 | | continue; |
| | 68 | | } |
| 8 | 69 | | if (property.NameEquals("keyvaultproperties")) |
| | 70 | | { |
| 8 | 71 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 72 | | { |
| | 73 | | continue; |
| | 74 | | } |
| 8 | 75 | | keyvaultproperties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value); |
| | 76 | | continue; |
| | 77 | | } |
| | 78 | | } |
| 836 | 79 | | return new Encryption(services, keySource, requireInfrastructureEncryption, keyvaultproperties); |
| | 80 | | } |
| | 81 | | } |
| | 82 | | } |