| | 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 VirtualMachineScaleSetOSProfile : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 364 | 18 | | writer.WriteStartObject(); |
| 364 | 19 | | if (ComputerNamePrefix != null) |
| | 20 | | { |
| 364 | 21 | | writer.WritePropertyName("computerNamePrefix"); |
| 364 | 22 | | writer.WriteStringValue(ComputerNamePrefix); |
| | 23 | | } |
| 364 | 24 | | if (AdminUsername != null) |
| | 25 | | { |
| 364 | 26 | | writer.WritePropertyName("adminUsername"); |
| 364 | 27 | | writer.WriteStringValue(AdminUsername); |
| | 28 | | } |
| 364 | 29 | | if (AdminPassword != null) |
| | 30 | | { |
| 364 | 31 | | writer.WritePropertyName("adminPassword"); |
| 364 | 32 | | writer.WriteStringValue(AdminPassword); |
| | 33 | | } |
| 364 | 34 | | if (CustomData != null) |
| | 35 | | { |
| 364 | 36 | | writer.WritePropertyName("customData"); |
| 364 | 37 | | writer.WriteStringValue(CustomData); |
| | 38 | | } |
| 364 | 39 | | if (WindowsConfiguration != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("windowsConfiguration"); |
| 0 | 42 | | writer.WriteObjectValue(WindowsConfiguration); |
| | 43 | | } |
| 364 | 44 | | if (LinuxConfiguration != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("linuxConfiguration"); |
| 0 | 47 | | writer.WriteObjectValue(LinuxConfiguration); |
| | 48 | | } |
| 364 | 49 | | if (Secrets != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("secrets"); |
| 0 | 52 | | writer.WriteStartArray(); |
| 0 | 53 | | foreach (var item in Secrets) |
| | 54 | | { |
| 0 | 55 | | writer.WriteObjectValue(item); |
| | 56 | | } |
| 0 | 57 | | writer.WriteEndArray(); |
| | 58 | | } |
| 364 | 59 | | writer.WriteEndObject(); |
| 364 | 60 | | } |
| | 61 | |
|
| | 62 | | internal static VirtualMachineScaleSetOSProfile DeserializeVirtualMachineScaleSetOSProfile(JsonElement element) |
| | 63 | | { |
| 448 | 64 | | string computerNamePrefix = default; |
| 448 | 65 | | string adminUsername = default; |
| 448 | 66 | | string adminPassword = default; |
| 448 | 67 | | string customData = default; |
| 448 | 68 | | WindowsConfiguration windowsConfiguration = default; |
| 448 | 69 | | LinuxConfiguration linuxConfiguration = default; |
| 448 | 70 | | IList<VaultSecretGroup> secrets = default; |
| 6272 | 71 | | foreach (var property in element.EnumerateObject()) |
| | 72 | | { |
| 2688 | 73 | | if (property.NameEquals("computerNamePrefix")) |
| | 74 | | { |
| 448 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 76 | | { |
| | 77 | | continue; |
| | 78 | | } |
| 448 | 79 | | computerNamePrefix = property.Value.GetString(); |
| 448 | 80 | | continue; |
| | 81 | | } |
| 2240 | 82 | | if (property.NameEquals("adminUsername")) |
| | 83 | | { |
| 448 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 448 | 88 | | adminUsername = property.Value.GetString(); |
| 448 | 89 | | continue; |
| | 90 | | } |
| 1792 | 91 | | if (property.NameEquals("adminPassword")) |
| | 92 | | { |
| 0 | 93 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | adminPassword = property.Value.GetString(); |
| 0 | 98 | | continue; |
| | 99 | | } |
| 1792 | 100 | | if (property.NameEquals("customData")) |
| | 101 | | { |
| 0 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | customData = property.Value.GetString(); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 1792 | 109 | | if (property.NameEquals("windowsConfiguration")) |
| | 110 | | { |
| 440 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 440 | 115 | | windowsConfiguration = WindowsConfiguration.DeserializeWindowsConfiguration(property.Value); |
| 440 | 116 | | continue; |
| | 117 | | } |
| 1352 | 118 | | if (property.NameEquals("linuxConfiguration")) |
| | 119 | | { |
| 8 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 8 | 124 | | linuxConfiguration = LinuxConfiguration.DeserializeLinuxConfiguration(property.Value); |
| 8 | 125 | | continue; |
| | 126 | | } |
| 1344 | 127 | | if (property.NameEquals("secrets")) |
| | 128 | | { |
| 448 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 448 | 133 | | List<VaultSecretGroup> array = new List<VaultSecretGroup>(); |
| 0 | 134 | | foreach (var item in property.Value.EnumerateArray()) |
| | 135 | | { |
| 0 | 136 | | if (item.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| 0 | 138 | | array.Add(null); |
| | 139 | | } |
| | 140 | | else |
| | 141 | | { |
| 0 | 142 | | array.Add(VaultSecretGroup.DeserializeVaultSecretGroup(item)); |
| | 143 | | } |
| | 144 | | } |
| 448 | 145 | | secrets = array; |
| | 146 | | continue; |
| | 147 | | } |
| | 148 | | } |
| 448 | 149 | | return new VirtualMachineScaleSetOSProfile(computerNamePrefix, adminUsername, adminPassword, customData, win |
| | 150 | | } |
| | 151 | | } |
| | 152 | | } |