| | 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.EventHubs.Models |
| | 12 | | { |
| | 13 | | public partial class VirtualNetworkRule : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Id != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("id"); |
| 0 | 21 | | writer.WriteStringValue(Id); |
| | 22 | | } |
| 0 | 23 | | if (Name != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("name"); |
| 0 | 26 | | writer.WriteStringValue(Name); |
| | 27 | | } |
| 0 | 28 | | if (Type != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("type"); |
| 0 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 0 | 33 | | writer.WritePropertyName("properties"); |
| 0 | 34 | | writer.WriteStartObject(); |
| 0 | 35 | | if (VirtualNetworkSubnetId != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("virtualNetworkSubnetId"); |
| 0 | 38 | | writer.WriteStringValue(VirtualNetworkSubnetId); |
| | 39 | | } |
| 0 | 40 | | writer.WriteEndObject(); |
| 0 | 41 | | writer.WriteEndObject(); |
| 0 | 42 | | } |
| | 43 | |
|
| | 44 | | internal static VirtualNetworkRule DeserializeVirtualNetworkRule(JsonElement element) |
| | 45 | | { |
| 0 | 46 | | string id = default; |
| 0 | 47 | | string name = default; |
| 0 | 48 | | string type = default; |
| 0 | 49 | | string virtualNetworkSubnetId = default; |
| 0 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 0 | 52 | | if (property.NameEquals("id")) |
| | 53 | | { |
| 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | id = property.Value.GetString(); |
| 0 | 59 | | continue; |
| | 60 | | } |
| 0 | 61 | | if (property.NameEquals("name")) |
| | 62 | | { |
| 0 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | name = property.Value.GetString(); |
| 0 | 68 | | continue; |
| | 69 | | } |
| 0 | 70 | | if (property.NameEquals("type")) |
| | 71 | | { |
| 0 | 72 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| | 74 | | continue; |
| | 75 | | } |
| 0 | 76 | | type = property.Value.GetString(); |
| 0 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("properties")) |
| | 80 | | { |
| 0 | 81 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 82 | | { |
| 0 | 83 | | if (property0.NameEquals("virtualNetworkSubnetId")) |
| | 84 | | { |
| 0 | 85 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | virtualNetworkSubnetId = property0.Value.GetString(); |
| | 90 | | continue; |
| | 91 | | } |
| | 92 | | } |
| | 93 | | continue; |
| | 94 | | } |
| | 95 | | } |
| 0 | 96 | | return new VirtualNetworkRule(id, name, type, virtualNetworkSubnetId); |
| | 97 | | } |
| | 98 | | } |
| | 99 | | } |