| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class EncryptionSettingsCollection : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 4 | 18 | | writer.WriteStartObject(); |
| 4 | 19 | | writer.WritePropertyName("enabled"); |
| 4 | 20 | | writer.WriteBooleanValue(Enabled); |
| 4 | 21 | | if (EncryptionSettings != null) |
| | 22 | | { |
| 4 | 23 | | writer.WritePropertyName("encryptionSettings"); |
| 4 | 24 | | writer.WriteStartArray(); |
| 16 | 25 | | foreach (var item in EncryptionSettings) |
| | 26 | | { |
| 4 | 27 | | writer.WriteObjectValue(item); |
| | 28 | | } |
| 4 | 29 | | writer.WriteEndArray(); |
| | 30 | | } |
| 4 | 31 | | if (EncryptionSettingsVersion != null) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("encryptionSettingsVersion"); |
| 0 | 34 | | writer.WriteStringValue(EncryptionSettingsVersion); |
| | 35 | | } |
| 4 | 36 | | writer.WriteEndObject(); |
| 4 | 37 | | } |
| | 38 | |
|
| | 39 | | internal static EncryptionSettingsCollection DeserializeEncryptionSettingsCollection(JsonElement element) |
| | 40 | | { |
| 0 | 41 | | bool enabled = default; |
| 0 | 42 | | IList<EncryptionSettingsElement> encryptionSettings = default; |
| 0 | 43 | | string encryptionSettingsVersion = default; |
| 0 | 44 | | foreach (var property in element.EnumerateObject()) |
| | 45 | | { |
| 0 | 46 | | if (property.NameEquals("enabled")) |
| | 47 | | { |
| 0 | 48 | | enabled = property.Value.GetBoolean(); |
| 0 | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | if (property.NameEquals("encryptionSettings")) |
| | 52 | | { |
| 0 | 53 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 54 | | { |
| | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | List<EncryptionSettingsElement> array = new List<EncryptionSettingsElement>(); |
| 0 | 58 | | foreach (var item in property.Value.EnumerateArray()) |
| | 59 | | { |
| 0 | 60 | | if (item.ValueKind == JsonValueKind.Null) |
| | 61 | | { |
| 0 | 62 | | array.Add(null); |
| | 63 | | } |
| | 64 | | else |
| | 65 | | { |
| 0 | 66 | | array.Add(EncryptionSettingsElement.DeserializeEncryptionSettingsElement(item)); |
| | 67 | | } |
| | 68 | | } |
| 0 | 69 | | encryptionSettings = array; |
| 0 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("encryptionSettingsVersion")) |
| | 73 | | { |
| 0 | 74 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | encryptionSettingsVersion = property.Value.GetString(); |
| | 79 | | continue; |
| | 80 | | } |
| | 81 | | } |
| 0 | 82 | | return new EncryptionSettingsCollection(enabled, encryptionSettings, encryptionSettingsVersion); |
| | 83 | | } |
| | 84 | | } |
| | 85 | | } |