| | 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 NetworkInterface : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 188 | 18 | | writer.WriteStartObject(); |
| 188 | 19 | | if (Etag != null) |
| | 20 | | { |
| 56 | 21 | | writer.WritePropertyName("etag"); |
| 56 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 188 | 24 | | if (Id != null) |
| | 25 | | { |
| 56 | 26 | | writer.WritePropertyName("id"); |
| 56 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 188 | 29 | | if (Name != null) |
| | 30 | | { |
| 56 | 31 | | writer.WritePropertyName("name"); |
| 56 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 188 | 34 | | if (Type != null) |
| | 35 | | { |
| 56 | 36 | | writer.WritePropertyName("type"); |
| 56 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 188 | 39 | | if (Location != null) |
| | 40 | | { |
| 188 | 41 | | writer.WritePropertyName("location"); |
| 188 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 188 | 44 | | if (Tags != null) |
| | 45 | | { |
| 188 | 46 | | writer.WritePropertyName("tags"); |
| 188 | 47 | | writer.WriteStartObject(); |
| 752 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 188 | 50 | | writer.WritePropertyName(item.Key); |
| 188 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 188 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 188 | 55 | | writer.WritePropertyName("properties"); |
| 188 | 56 | | writer.WriteStartObject(); |
| 188 | 57 | | if (VirtualMachine != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("virtualMachine"); |
| 0 | 60 | | writer.WriteObjectValue(VirtualMachine); |
| | 61 | | } |
| 188 | 62 | | if (NetworkSecurityGroup != null) |
| | 63 | | { |
| 8 | 64 | | writer.WritePropertyName("networkSecurityGroup"); |
| 8 | 65 | | writer.WriteObjectValue(NetworkSecurityGroup); |
| | 66 | | } |
| 188 | 67 | | if (PrivateEndpoint != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("privateEndpoint"); |
| 0 | 70 | | writer.WriteObjectValue(PrivateEndpoint); |
| | 71 | | } |
| 188 | 72 | | if (IpConfigurations != null) |
| | 73 | | { |
| 188 | 74 | | writer.WritePropertyName("ipConfigurations"); |
| 188 | 75 | | writer.WriteStartArray(); |
| 808 | 76 | | foreach (var item in IpConfigurations) |
| | 77 | | { |
| 216 | 78 | | writer.WriteObjectValue(item); |
| | 79 | | } |
| 188 | 80 | | writer.WriteEndArray(); |
| | 81 | | } |
| 188 | 82 | | if (TapConfigurations != null) |
| | 83 | | { |
| 56 | 84 | | writer.WritePropertyName("tapConfigurations"); |
| 56 | 85 | | writer.WriteStartArray(); |
| 0 | 86 | | foreach (var item in TapConfigurations) |
| | 87 | | { |
| 0 | 88 | | writer.WriteObjectValue(item); |
| | 89 | | } |
| 56 | 90 | | writer.WriteEndArray(); |
| | 91 | | } |
| 188 | 92 | | if (DnsSettings != null) |
| | 93 | | { |
| 72 | 94 | | writer.WritePropertyName("dnsSettings"); |
| 72 | 95 | | writer.WriteObjectValue(DnsSettings); |
| | 96 | | } |
| 188 | 97 | | if (MacAddress != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("macAddress"); |
| 0 | 100 | | writer.WriteStringValue(MacAddress); |
| | 101 | | } |
| 188 | 102 | | if (Primary != null) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName("primary"); |
| 0 | 105 | | writer.WriteBooleanValue(Primary.Value); |
| | 106 | | } |
| 188 | 107 | | if (EnableAcceleratedNetworking != null) |
| | 108 | | { |
| 64 | 109 | | writer.WritePropertyName("enableAcceleratedNetworking"); |
| 64 | 110 | | writer.WriteBooleanValue(EnableAcceleratedNetworking.Value); |
| | 111 | | } |
| 188 | 112 | | if (EnableIPForwarding != null) |
| | 113 | | { |
| 64 | 114 | | writer.WritePropertyName("enableIPForwarding"); |
| 64 | 115 | | writer.WriteBooleanValue(EnableIPForwarding.Value); |
| | 116 | | } |
| 188 | 117 | | if (HostedWorkloads != null) |
| | 118 | | { |
| 56 | 119 | | writer.WritePropertyName("hostedWorkloads"); |
| 56 | 120 | | writer.WriteStartArray(); |
| 0 | 121 | | foreach (var item in HostedWorkloads) |
| | 122 | | { |
| 0 | 123 | | writer.WriteStringValue(item); |
| | 124 | | } |
| 56 | 125 | | writer.WriteEndArray(); |
| | 126 | | } |
| 188 | 127 | | if (ResourceGuid != null) |
| | 128 | | { |
| 56 | 129 | | writer.WritePropertyName("resourceGuid"); |
| 56 | 130 | | writer.WriteStringValue(ResourceGuid); |
| | 131 | | } |
| 188 | 132 | | if (ProvisioningState != null) |
| | 133 | | { |
| 56 | 134 | | writer.WritePropertyName("provisioningState"); |
| 56 | 135 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 136 | | } |
| 188 | 137 | | writer.WriteEndObject(); |
| 188 | 138 | | writer.WriteEndObject(); |
| 188 | 139 | | } |
| | 140 | |
|
| | 141 | | internal static NetworkInterface DeserializeNetworkInterface(JsonElement element) |
| | 142 | | { |
| 264 | 143 | | string etag = default; |
| 264 | 144 | | string id = default; |
| 264 | 145 | | string name = default; |
| 264 | 146 | | string type = default; |
| 264 | 147 | | string location = default; |
| 264 | 148 | | IDictionary<string, string> tags = default; |
| 264 | 149 | | SubResource virtualMachine = default; |
| 264 | 150 | | NetworkSecurityGroup networkSecurityGroup = default; |
| 264 | 151 | | PrivateEndpoint privateEndpoint = default; |
| 264 | 152 | | IList<NetworkInterfaceIPConfiguration> ipConfigurations = default; |
| 264 | 153 | | IList<NetworkInterfaceTapConfiguration> tapConfigurations = default; |
| 264 | 154 | | NetworkInterfaceDnsSettings dnsSettings = default; |
| 264 | 155 | | string macAddress = default; |
| 264 | 156 | | bool? primary = default; |
| 264 | 157 | | bool? enableAcceleratedNetworking = default; |
| 264 | 158 | | bool? enableIPForwarding = default; |
| 264 | 159 | | IList<string> hostedWorkloads = default; |
| 264 | 160 | | string resourceGuid = default; |
| 264 | 161 | | ProvisioningState? provisioningState = default; |
| 3928 | 162 | | foreach (var property in element.EnumerateObject()) |
| | 163 | | { |
| 1700 | 164 | | if (property.NameEquals("etag")) |
| | 165 | | { |
| 252 | 166 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 252 | 170 | | etag = property.Value.GetString(); |
| 252 | 171 | | continue; |
| | 172 | | } |
| 1448 | 173 | | if (property.NameEquals("id")) |
| | 174 | | { |
| 264 | 175 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 264 | 179 | | id = property.Value.GetString(); |
| 264 | 180 | | continue; |
| | 181 | | } |
| 1184 | 182 | | if (property.NameEquals("name")) |
| | 183 | | { |
| 252 | 184 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 252 | 188 | | name = property.Value.GetString(); |
| 252 | 189 | | continue; |
| | 190 | | } |
| 932 | 191 | | if (property.NameEquals("type")) |
| | 192 | | { |
| 228 | 193 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 228 | 197 | | type = property.Value.GetString(); |
| 228 | 198 | | continue; |
| | 199 | | } |
| 704 | 200 | | if (property.NameEquals("location")) |
| | 201 | | { |
| 228 | 202 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 228 | 206 | | location = property.Value.GetString(); |
| 228 | 207 | | continue; |
| | 208 | | } |
| 476 | 209 | | if (property.NameEquals("tags")) |
| | 210 | | { |
| 224 | 211 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 224 | 215 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 896 | 216 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 217 | | { |
| 224 | 218 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| 0 | 220 | | dictionary.Add(property0.Name, null); |
| | 221 | | } |
| | 222 | | else |
| | 223 | | { |
| 224 | 224 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 225 | | } |
| | 226 | | } |
| 224 | 227 | | tags = dictionary; |
| 224 | 228 | | continue; |
| | 229 | | } |
| 252 | 230 | | if (property.NameEquals("properties")) |
| | 231 | | { |
| 5312 | 232 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 233 | | { |
| 2404 | 234 | | if (property0.NameEquals("virtualMachine")) |
| | 235 | | { |
| 40 | 236 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 237 | | { |
| | 238 | | continue; |
| | 239 | | } |
| 40 | 240 | | virtualMachine = SubResource.DeserializeSubResource(property0.Value); |
| 40 | 241 | | continue; |
| | 242 | | } |
| 2364 | 243 | | if (property0.NameEquals("networkSecurityGroup")) |
| | 244 | | { |
| 48 | 245 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 246 | | { |
| | 247 | | continue; |
| | 248 | | } |
| 48 | 249 | | networkSecurityGroup = NetworkSecurityGroup.DeserializeNetworkSecurityGroup(property0.Value) |
| 48 | 250 | | continue; |
| | 251 | | } |
| 2316 | 252 | | if (property0.NameEquals("privateEndpoint")) |
| | 253 | | { |
| 0 | 254 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 255 | | { |
| | 256 | | continue; |
| | 257 | | } |
| 0 | 258 | | privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); |
| 0 | 259 | | continue; |
| | 260 | | } |
| 2316 | 261 | | if (property0.NameEquals("ipConfigurations")) |
| | 262 | | { |
| 252 | 263 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 264 | | { |
| | 265 | | continue; |
| | 266 | | } |
| 252 | 267 | | List<NetworkInterfaceIPConfiguration> array = new List<NetworkInterfaceIPConfiguration>(); |
| 1104 | 268 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 269 | | { |
| 300 | 270 | | if (item.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| 0 | 272 | | array.Add(null); |
| | 273 | | } |
| | 274 | | else |
| | 275 | | { |
| 300 | 276 | | array.Add(NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration |
| | 277 | | } |
| | 278 | | } |
| 252 | 279 | | ipConfigurations = array; |
| 252 | 280 | | continue; |
| | 281 | | } |
| 2064 | 282 | | if (property0.NameEquals("tapConfigurations")) |
| | 283 | | { |
| 252 | 284 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 285 | | { |
| | 286 | | continue; |
| | 287 | | } |
| 252 | 288 | | List<NetworkInterfaceTapConfiguration> array = new List<NetworkInterfaceTapConfiguration>(); |
| 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(NetworkInterfaceTapConfiguration.DeserializeNetworkInterfaceTapConfigurati |
| | 298 | | } |
| | 299 | | } |
| 252 | 300 | | tapConfigurations = array; |
| 252 | 301 | | continue; |
| | 302 | | } |
| 1812 | 303 | | if (property0.NameEquals("dnsSettings")) |
| | 304 | | { |
| 252 | 305 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 306 | | { |
| | 307 | | continue; |
| | 308 | | } |
| 252 | 309 | | dnsSettings = NetworkInterfaceDnsSettings.DeserializeNetworkInterfaceDnsSettings(property0.V |
| 252 | 310 | | continue; |
| | 311 | | } |
| 1560 | 312 | | if (property0.NameEquals("macAddress")) |
| | 313 | | { |
| 40 | 314 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 315 | | { |
| | 316 | | continue; |
| | 317 | | } |
| 40 | 318 | | macAddress = property0.Value.GetString(); |
| 40 | 319 | | continue; |
| | 320 | | } |
| 1520 | 321 | | if (property0.NameEquals("primary")) |
| | 322 | | { |
| 32 | 323 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 324 | | { |
| | 325 | | continue; |
| | 326 | | } |
| 32 | 327 | | primary = property0.Value.GetBoolean(); |
| 32 | 328 | | continue; |
| | 329 | | } |
| 1488 | 330 | | if (property0.NameEquals("enableAcceleratedNetworking")) |
| | 331 | | { |
| 252 | 332 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 333 | | { |
| | 334 | | continue; |
| | 335 | | } |
| 252 | 336 | | enableAcceleratedNetworking = property0.Value.GetBoolean(); |
| 252 | 337 | | continue; |
| | 338 | | } |
| 1236 | 339 | | if (property0.NameEquals("enableIPForwarding")) |
| | 340 | | { |
| 252 | 341 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 342 | | { |
| | 343 | | continue; |
| | 344 | | } |
| 252 | 345 | | enableIPForwarding = property0.Value.GetBoolean(); |
| 252 | 346 | | continue; |
| | 347 | | } |
| 984 | 348 | | if (property0.NameEquals("hostedWorkloads")) |
| | 349 | | { |
| 252 | 350 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 351 | | { |
| | 352 | | continue; |
| | 353 | | } |
| 252 | 354 | | List<string> array = new List<string>(); |
| 0 | 355 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 356 | | { |
| 0 | 357 | | if (item.ValueKind == JsonValueKind.Null) |
| | 358 | | { |
| 0 | 359 | | array.Add(null); |
| | 360 | | } |
| | 361 | | else |
| | 362 | | { |
| 0 | 363 | | array.Add(item.GetString()); |
| | 364 | | } |
| | 365 | | } |
| 252 | 366 | | hostedWorkloads = array; |
| 252 | 367 | | continue; |
| | 368 | | } |
| 732 | 369 | | if (property0.NameEquals("resourceGuid")) |
| | 370 | | { |
| 252 | 371 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 372 | | { |
| | 373 | | continue; |
| | 374 | | } |
| 252 | 375 | | resourceGuid = property0.Value.GetString(); |
| 252 | 376 | | continue; |
| | 377 | | } |
| 480 | 378 | | if (property0.NameEquals("provisioningState")) |
| | 379 | | { |
| 252 | 380 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 381 | | { |
| | 382 | | continue; |
| | 383 | | } |
| 252 | 384 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 385 | | continue; |
| | 386 | | } |
| | 387 | | } |
| | 388 | | continue; |
| | 389 | | } |
| | 390 | | } |
| 264 | 391 | | return new NetworkInterface(id, name, type, location, tags, etag, virtualMachine, networkSecurityGroup, priv |
| | 392 | | } |
| | 393 | | } |
| | 394 | | } |