| | 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 SshConfiguration : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (PublicKeys != null) |
| | 20 | | { |
| 16 | 21 | | writer.WritePropertyName("publicKeys"); |
| 16 | 22 | | writer.WriteStartArray(); |
| 64 | 23 | | foreach (var item in PublicKeys) |
| | 24 | | { |
| 16 | 25 | | writer.WriteObjectValue(item); |
| | 26 | | } |
| 16 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 16 | 29 | | writer.WriteEndObject(); |
| 16 | 30 | | } |
| | 31 | |
|
| | 32 | | internal static SshConfiguration DeserializeSshConfiguration(JsonElement element) |
| | 33 | | { |
| 16 | 34 | | IList<SshPublicKey> publicKeys = default; |
| 64 | 35 | | foreach (var property in element.EnumerateObject()) |
| | 36 | | { |
| 16 | 37 | | if (property.NameEquals("publicKeys")) |
| | 38 | | { |
| 16 | 39 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 40 | | { |
| | 41 | | continue; |
| | 42 | | } |
| 16 | 43 | | List<SshPublicKey> array = new List<SshPublicKey>(); |
| 64 | 44 | | foreach (var item in property.Value.EnumerateArray()) |
| | 45 | | { |
| 16 | 46 | | if (item.ValueKind == JsonValueKind.Null) |
| | 47 | | { |
| 0 | 48 | | array.Add(null); |
| | 49 | | } |
| | 50 | | else |
| | 51 | | { |
| 16 | 52 | | array.Add(SshPublicKey.DeserializeSshPublicKey(item)); |
| | 53 | | } |
| | 54 | | } |
| 16 | 55 | | publicKeys = array; |
| | 56 | | continue; |
| | 57 | | } |
| | 58 | | } |
| 16 | 59 | | return new SshConfiguration(publicKeys); |
| | 60 | | } |
| | 61 | | } |
| | 62 | | } |