| | 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 OSProfile : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 244 | 18 | | writer.WriteStartObject(); |
| 244 | 19 | | if (ComputerName != null) |
| | 20 | | { |
| 244 | 21 | | writer.WritePropertyName("computerName"); |
| 244 | 22 | | writer.WriteStringValue(ComputerName); |
| | 23 | | } |
| 244 | 24 | | if (AdminUsername != null) |
| | 25 | | { |
| 244 | 26 | | writer.WritePropertyName("adminUsername"); |
| 244 | 27 | | writer.WriteStringValue(AdminUsername); |
| | 28 | | } |
| 244 | 29 | | if (AdminPassword != null) |
| | 30 | | { |
| 228 | 31 | | writer.WritePropertyName("adminPassword"); |
| 228 | 32 | | writer.WriteStringValue(AdminPassword); |
| | 33 | | } |
| 244 | 34 | | if (CustomData != null) |
| | 35 | | { |
| 8 | 36 | | writer.WritePropertyName("customData"); |
| 8 | 37 | | writer.WriteStringValue(CustomData); |
| | 38 | | } |
| 244 | 39 | | if (WindowsConfiguration != null) |
| | 40 | | { |
| 8 | 41 | | writer.WritePropertyName("windowsConfiguration"); |
| 8 | 42 | | writer.WriteObjectValue(WindowsConfiguration); |
| | 43 | | } |
| 244 | 44 | | if (LinuxConfiguration != null) |
| | 45 | | { |
| 16 | 46 | | writer.WritePropertyName("linuxConfiguration"); |
| 16 | 47 | | writer.WriteObjectValue(LinuxConfiguration); |
| | 48 | | } |
| 244 | 49 | | if (Secrets != null) |
| | 50 | | { |
| 16 | 51 | | writer.WritePropertyName("secrets"); |
| 16 | 52 | | writer.WriteStartArray(); |
| 0 | 53 | | foreach (var item in Secrets) |
| | 54 | | { |
| 0 | 55 | | writer.WriteObjectValue(item); |
| | 56 | | } |
| 16 | 57 | | writer.WriteEndArray(); |
| | 58 | | } |
| 244 | 59 | | if (AllowExtensionOperations != null) |
| | 60 | | { |
| 16 | 61 | | writer.WritePropertyName("allowExtensionOperations"); |
| 16 | 62 | | writer.WriteBooleanValue(AllowExtensionOperations.Value); |
| | 63 | | } |
| 244 | 64 | | if (RequireGuestProvisionSignal != null) |
| | 65 | | { |
| 16 | 66 | | writer.WritePropertyName("requireGuestProvisionSignal"); |
| 16 | 67 | | writer.WriteBooleanValue(RequireGuestProvisionSignal.Value); |
| | 68 | | } |
| 244 | 69 | | writer.WriteEndObject(); |
| 244 | 70 | | } |
| | 71 | |
|
| | 72 | | internal static OSProfile DeserializeOSProfile(JsonElement element) |
| | 73 | | { |
| 432 | 74 | | string computerName = default; |
| 432 | 75 | | string adminUsername = default; |
| 432 | 76 | | string adminPassword = default; |
| 432 | 77 | | string customData = default; |
| 432 | 78 | | WindowsConfiguration windowsConfiguration = default; |
| 432 | 79 | | LinuxConfiguration linuxConfiguration = default; |
| 432 | 80 | | IList<VaultSecretGroup> secrets = default; |
| 432 | 81 | | bool? allowExtensionOperations = default; |
| 432 | 82 | | bool? requireGuestProvisionSignal = default; |
| 6048 | 83 | | foreach (var property in element.EnumerateObject()) |
| | 84 | | { |
| 2592 | 85 | | if (property.NameEquals("computerName")) |
| | 86 | | { |
| 432 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 432 | 91 | | computerName = property.Value.GetString(); |
| 432 | 92 | | continue; |
| | 93 | | } |
| 2160 | 94 | | if (property.NameEquals("adminUsername")) |
| | 95 | | { |
| 432 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 97 | | { |
| | 98 | | continue; |
| | 99 | | } |
| 432 | 100 | | adminUsername = property.Value.GetString(); |
| 432 | 101 | | continue; |
| | 102 | | } |
| 1728 | 103 | | if (property.NameEquals("adminPassword")) |
| | 104 | | { |
| 0 | 105 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | adminPassword = property.Value.GetString(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 1728 | 112 | | if (property.NameEquals("customData")) |
| | 113 | | { |
| 0 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | customData = property.Value.GetString(); |
| 0 | 119 | | continue; |
| | 120 | | } |
| 1728 | 121 | | if (property.NameEquals("windowsConfiguration")) |
| | 122 | | { |
| 416 | 123 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 124 | | { |
| | 125 | | continue; |
| | 126 | | } |
| 416 | 127 | | windowsConfiguration = WindowsConfiguration.DeserializeWindowsConfiguration(property.Value); |
| 416 | 128 | | continue; |
| | 129 | | } |
| 1312 | 130 | | if (property.NameEquals("linuxConfiguration")) |
| | 131 | | { |
| 16 | 132 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 133 | | { |
| | 134 | | continue; |
| | 135 | | } |
| 16 | 136 | | linuxConfiguration = LinuxConfiguration.DeserializeLinuxConfiguration(property.Value); |
| 16 | 137 | | continue; |
| | 138 | | } |
| 1296 | 139 | | if (property.NameEquals("secrets")) |
| | 140 | | { |
| 432 | 141 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 142 | | { |
| | 143 | | continue; |
| | 144 | | } |
| 432 | 145 | | List<VaultSecretGroup> array = new List<VaultSecretGroup>(); |
| 0 | 146 | | foreach (var item in property.Value.EnumerateArray()) |
| | 147 | | { |
| 0 | 148 | | if (item.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| 0 | 150 | | array.Add(null); |
| | 151 | | } |
| | 152 | | else |
| | 153 | | { |
| 0 | 154 | | array.Add(VaultSecretGroup.DeserializeVaultSecretGroup(item)); |
| | 155 | | } |
| | 156 | | } |
| 432 | 157 | | secrets = array; |
| 432 | 158 | | continue; |
| | 159 | | } |
| 864 | 160 | | if (property.NameEquals("allowExtensionOperations")) |
| | 161 | | { |
| 432 | 162 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 163 | | { |
| | 164 | | continue; |
| | 165 | | } |
| 432 | 166 | | allowExtensionOperations = property.Value.GetBoolean(); |
| 432 | 167 | | continue; |
| | 168 | | } |
| 432 | 169 | | if (property.NameEquals("requireGuestProvisionSignal")) |
| | 170 | | { |
| 432 | 171 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 172 | | { |
| | 173 | | continue; |
| | 174 | | } |
| 432 | 175 | | requireGuestProvisionSignal = property.Value.GetBoolean(); |
| | 176 | | continue; |
| | 177 | | } |
| | 178 | | } |
| 432 | 179 | | return new OSProfile(computerName, adminUsername, adminPassword, customData, windowsConfiguration, linuxConf |
| | 180 | | } |
| | 181 | | } |
| | 182 | | } |