| | 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.Network.Models |
| | 13 | | { |
| | 14 | | public partial class NetworkVirtualAppliance : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Identity != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("identity"); |
| 0 | 22 | | writer.WriteObjectValue(Identity); |
| | 23 | | } |
| 0 | 24 | | if (Sku != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("sku"); |
| 0 | 27 | | writer.WriteObjectValue(Sku); |
| | 28 | | } |
| 0 | 29 | | if (Etag != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("etag"); |
| 0 | 32 | | writer.WriteStringValue(Etag); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | if (Name != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("name"); |
| 0 | 42 | | writer.WriteStringValue(Name); |
| | 43 | | } |
| 0 | 44 | | if (Type != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("type"); |
| 0 | 47 | | writer.WriteStringValue(Type); |
| | 48 | | } |
| 0 | 49 | | if (Location != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("location"); |
| 0 | 52 | | writer.WriteStringValue(Location); |
| | 53 | | } |
| 0 | 54 | | if (Tags != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("tags"); |
| 0 | 57 | | writer.WriteStartObject(); |
| 0 | 58 | | foreach (var item in Tags) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName(item.Key); |
| 0 | 61 | | writer.WriteStringValue(item.Value); |
| | 62 | | } |
| 0 | 63 | | writer.WriteEndObject(); |
| | 64 | | } |
| 0 | 65 | | writer.WritePropertyName("properties"); |
| 0 | 66 | | writer.WriteStartObject(); |
| 0 | 67 | | if (BootStrapConfigurationBlob != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("bootStrapConfigurationBlob"); |
| 0 | 70 | | writer.WriteStartArray(); |
| 0 | 71 | | foreach (var item in BootStrapConfigurationBlob) |
| | 72 | | { |
| 0 | 73 | | writer.WriteStringValue(item); |
| | 74 | | } |
| 0 | 75 | | writer.WriteEndArray(); |
| | 76 | | } |
| 0 | 77 | | if (VirtualHub != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("virtualHub"); |
| 0 | 80 | | writer.WriteObjectValue(VirtualHub); |
| | 81 | | } |
| 0 | 82 | | if (CloudInitConfigurationBlob != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("cloudInitConfigurationBlob"); |
| 0 | 85 | | writer.WriteStartArray(); |
| 0 | 86 | | foreach (var item in CloudInitConfigurationBlob) |
| | 87 | | { |
| 0 | 88 | | writer.WriteStringValue(item); |
| | 89 | | } |
| 0 | 90 | | writer.WriteEndArray(); |
| | 91 | | } |
| 0 | 92 | | if (VirtualApplianceAsn != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("virtualApplianceAsn"); |
| 0 | 95 | | writer.WriteNumberValue(VirtualApplianceAsn.Value); |
| | 96 | | } |
| 0 | 97 | | if (VirtualApplianceNics != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("virtualApplianceNics"); |
| 0 | 100 | | writer.WriteStartArray(); |
| 0 | 101 | | foreach (var item in VirtualApplianceNics) |
| | 102 | | { |
| 0 | 103 | | writer.WriteObjectValue(item); |
| | 104 | | } |
| 0 | 105 | | writer.WriteEndArray(); |
| | 106 | | } |
| 0 | 107 | | if (ProvisioningState != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("provisioningState"); |
| 0 | 110 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 111 | | } |
| 0 | 112 | | writer.WriteEndObject(); |
| 0 | 113 | | writer.WriteEndObject(); |
| 0 | 114 | | } |
| | 115 | |
|
| | 116 | | internal static NetworkVirtualAppliance DeserializeNetworkVirtualAppliance(JsonElement element) |
| | 117 | | { |
| 0 | 118 | | ManagedServiceIdentity identity = default; |
| 0 | 119 | | VirtualApplianceSkuProperties sku = default; |
| 0 | 120 | | string etag = default; |
| 0 | 121 | | string id = default; |
| 0 | 122 | | string name = default; |
| 0 | 123 | | string type = default; |
| 0 | 124 | | string location = default; |
| 0 | 125 | | IDictionary<string, string> tags = default; |
| 0 | 126 | | IList<string> bootStrapConfigurationBlob = default; |
| 0 | 127 | | SubResource virtualHub = default; |
| 0 | 128 | | IList<string> cloudInitConfigurationBlob = default; |
| 0 | 129 | | long? virtualApplianceAsn = default; |
| 0 | 130 | | IList<VirtualApplianceNicProperties> virtualApplianceNics = default; |
| 0 | 131 | | ProvisioningState? provisioningState = default; |
| 0 | 132 | | foreach (var property in element.EnumerateObject()) |
| | 133 | | { |
| 0 | 134 | | if (property.NameEquals("identity")) |
| | 135 | | { |
| 0 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property.NameEquals("sku")) |
| | 144 | | { |
| 0 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | sku = VirtualApplianceSkuProperties.DeserializeVirtualApplianceSkuProperties(property.Value); |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property.NameEquals("etag")) |
| | 153 | | { |
| 0 | 154 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | etag = property.Value.GetString(); |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property.NameEquals("id")) |
| | 162 | | { |
| 0 | 163 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | id = property.Value.GetString(); |
| 0 | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | if (property.NameEquals("name")) |
| | 171 | | { |
| 0 | 172 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | name = property.Value.GetString(); |
| 0 | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | if (property.NameEquals("type")) |
| | 180 | | { |
| 0 | 181 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 182 | | { |
| | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | type = property.Value.GetString(); |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property.NameEquals("location")) |
| | 189 | | { |
| 0 | 190 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 191 | | { |
| | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | location = property.Value.GetString(); |
| 0 | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | if (property.NameEquals("tags")) |
| | 198 | | { |
| 0 | 199 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 200 | | { |
| | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 204 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 205 | | { |
| 0 | 206 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 207 | | { |
| 0 | 208 | | dictionary.Add(property0.Name, null); |
| | 209 | | } |
| | 210 | | else |
| | 211 | | { |
| 0 | 212 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 213 | | } |
| | 214 | | } |
| 0 | 215 | | tags = dictionary; |
| 0 | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | if (property.NameEquals("properties")) |
| | 219 | | { |
| 0 | 220 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 221 | | { |
| 0 | 222 | | if (property0.NameEquals("bootStrapConfigurationBlob")) |
| | 223 | | { |
| 0 | 224 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 225 | | { |
| | 226 | | continue; |
| | 227 | | } |
| 0 | 228 | | List<string> array = new List<string>(); |
| 0 | 229 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 230 | | { |
| 0 | 231 | | if (item.ValueKind == JsonValueKind.Null) |
| | 232 | | { |
| 0 | 233 | | array.Add(null); |
| | 234 | | } |
| | 235 | | else |
| | 236 | | { |
| 0 | 237 | | array.Add(item.GetString()); |
| | 238 | | } |
| | 239 | | } |
| 0 | 240 | | bootStrapConfigurationBlob = array; |
| 0 | 241 | | continue; |
| | 242 | | } |
| 0 | 243 | | if (property0.NameEquals("virtualHub")) |
| | 244 | | { |
| 0 | 245 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 246 | | { |
| | 247 | | continue; |
| | 248 | | } |
| 0 | 249 | | virtualHub = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 250 | | continue; |
| | 251 | | } |
| 0 | 252 | | if (property0.NameEquals("cloudInitConfigurationBlob")) |
| | 253 | | { |
| 0 | 254 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 255 | | { |
| | 256 | | continue; |
| | 257 | | } |
| 0 | 258 | | List<string> array = new List<string>(); |
| 0 | 259 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 260 | | { |
| 0 | 261 | | if (item.ValueKind == JsonValueKind.Null) |
| | 262 | | { |
| 0 | 263 | | array.Add(null); |
| | 264 | | } |
| | 265 | | else |
| | 266 | | { |
| 0 | 267 | | array.Add(item.GetString()); |
| | 268 | | } |
| | 269 | | } |
| 0 | 270 | | cloudInitConfigurationBlob = array; |
| 0 | 271 | | continue; |
| | 272 | | } |
| 0 | 273 | | if (property0.NameEquals("virtualApplianceAsn")) |
| | 274 | | { |
| 0 | 275 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 276 | | { |
| | 277 | | continue; |
| | 278 | | } |
| 0 | 279 | | virtualApplianceAsn = property0.Value.GetInt64(); |
| 0 | 280 | | continue; |
| | 281 | | } |
| 0 | 282 | | if (property0.NameEquals("virtualApplianceNics")) |
| | 283 | | { |
| 0 | 284 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 285 | | { |
| | 286 | | continue; |
| | 287 | | } |
| 0 | 288 | | List<VirtualApplianceNicProperties> array = new List<VirtualApplianceNicProperties>(); |
| 0 | 289 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 290 | | { |
| 0 | 291 | | if (item.ValueKind == JsonValueKind.Null) |
| | 292 | | { |
| 0 | 293 | | array.Add(null); |
| | 294 | | } |
| | 295 | | else |
| | 296 | | { |
| 0 | 297 | | array.Add(VirtualApplianceNicProperties.DeserializeVirtualApplianceNicProperties(ite |
| | 298 | | } |
| | 299 | | } |
| 0 | 300 | | virtualApplianceNics = array; |
| 0 | 301 | | continue; |
| | 302 | | } |
| 0 | 303 | | if (property0.NameEquals("provisioningState")) |
| | 304 | | { |
| 0 | 305 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 306 | | { |
| | 307 | | continue; |
| | 308 | | } |
| 0 | 309 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 310 | | continue; |
| | 311 | | } |
| | 312 | | } |
| | 313 | | continue; |
| | 314 | | } |
| | 315 | | } |
| 0 | 316 | | return new NetworkVirtualAppliance(id, name, type, location, tags, identity, sku, etag, bootStrapConfigurati |
| | 317 | | } |
| | 318 | | } |
| | 319 | | } |