| | 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 ConnectionMonitorEndpointFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Type != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("type"); |
| 0 | 22 | | writer.WriteStringValue(Type); |
| | 23 | | } |
| 0 | 24 | | if (Items != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("items"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in Items) |
| | 29 | | { |
| 0 | 30 | | writer.WriteObjectValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 0 | 34 | | writer.WriteEndObject(); |
| 0 | 35 | | } |
| | 36 | |
|
| | 37 | | internal static ConnectionMonitorEndpointFilter DeserializeConnectionMonitorEndpointFilter(JsonElement element) |
| | 38 | | { |
| 0 | 39 | | string type = default; |
| 0 | 40 | | IList<ConnectionMonitorEndpointFilterItem> items = default; |
| 0 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 0 | 43 | | if (property.NameEquals("type")) |
| | 44 | | { |
| 0 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | type = property.Value.GetString(); |
| 0 | 50 | | continue; |
| | 51 | | } |
| 0 | 52 | | if (property.NameEquals("items")) |
| | 53 | | { |
| 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | List<ConnectionMonitorEndpointFilterItem> array = new List<ConnectionMonitorEndpointFilterItem>(); |
| 0 | 59 | | foreach (var item in property.Value.EnumerateArray()) |
| | 60 | | { |
| 0 | 61 | | if (item.ValueKind == JsonValueKind.Null) |
| | 62 | | { |
| 0 | 63 | | array.Add(null); |
| | 64 | | } |
| | 65 | | else |
| | 66 | | { |
| 0 | 67 | | array.Add(ConnectionMonitorEndpointFilterItem.DeserializeConnectionMonitorEndpointFilterItem |
| | 68 | | } |
| | 69 | | } |
| 0 | 70 | | items = array; |
| | 71 | | continue; |
| | 72 | | } |
| | 73 | | } |
| 0 | 74 | | return new ConnectionMonitorEndpointFilter(type, items); |
| | 75 | | } |
| | 76 | | } |
| | 77 | | } |