| | 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 NetworkInterfaceReference : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 260 | 17 | | writer.WriteStartObject(); |
| 260 | 18 | | if (Id != null) |
| | 19 | | { |
| 260 | 20 | | writer.WritePropertyName("id"); |
| 260 | 21 | | writer.WriteStringValue(Id); |
| | 22 | | } |
| 260 | 23 | | writer.WritePropertyName("properties"); |
| 260 | 24 | | writer.WriteStartObject(); |
| 260 | 25 | | if (Primary != null) |
| | 26 | | { |
| 32 | 27 | | writer.WritePropertyName("primary"); |
| 32 | 28 | | writer.WriteBooleanValue(Primary.Value); |
| | 29 | | } |
| 260 | 30 | | writer.WriteEndObject(); |
| 260 | 31 | | writer.WriteEndObject(); |
| 260 | 32 | | } |
| | 33 | |
|
| | 34 | | internal static NetworkInterfaceReference DeserializeNetworkInterfaceReference(JsonElement element) |
| | 35 | | { |
| 448 | 36 | | string id = default; |
| 448 | 37 | | bool? primary = default; |
| 1856 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 480 | 40 | | if (property.NameEquals("id")) |
| | 41 | | { |
| 448 | 42 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 43 | | { |
| | 44 | | continue; |
| | 45 | | } |
| 448 | 46 | | id = property.Value.GetString(); |
| 448 | 47 | | continue; |
| | 48 | | } |
| 32 | 49 | | if (property.NameEquals("properties")) |
| | 50 | | { |
| 128 | 51 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 52 | | { |
| 32 | 53 | | if (property0.NameEquals("primary")) |
| | 54 | | { |
| 32 | 55 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 56 | | { |
| | 57 | | continue; |
| | 58 | | } |
| 32 | 59 | | primary = property0.Value.GetBoolean(); |
| | 60 | | continue; |
| | 61 | | } |
| | 62 | | } |
| | 63 | | continue; |
| | 64 | | } |
| | 65 | | } |
| 448 | 66 | | return new NetworkInterfaceReference(id, primary); |
| | 67 | | } |
| | 68 | | } |
| | 69 | | } |