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