| | 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.Network.Models |
| | 12 | | { |
| | 13 | | public partial class ConnectionMonitorEndpoint : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("name"); |
| 0 | 19 | | writer.WriteStringValue(Name); |
| 0 | 20 | | if (ResourceId != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("resourceId"); |
| 0 | 23 | | writer.WriteStringValue(ResourceId); |
| | 24 | | } |
| 0 | 25 | | if (Address != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("address"); |
| 0 | 28 | | writer.WriteStringValue(Address); |
| | 29 | | } |
| 0 | 30 | | if (Filter != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("filter"); |
| 0 | 33 | | writer.WriteObjectValue(Filter); |
| | 34 | | } |
| 0 | 35 | | writer.WriteEndObject(); |
| 0 | 36 | | } |
| | 37 | |
|
| | 38 | | internal static ConnectionMonitorEndpoint DeserializeConnectionMonitorEndpoint(JsonElement element) |
| | 39 | | { |
| 0 | 40 | | string name = default; |
| 0 | 41 | | string resourceId = default; |
| 0 | 42 | | string address = default; |
| 0 | 43 | | ConnectionMonitorEndpointFilter filter = default; |
| 0 | 44 | | foreach (var property in element.EnumerateObject()) |
| | 45 | | { |
| 0 | 46 | | if (property.NameEquals("name")) |
| | 47 | | { |
| 0 | 48 | | name = property.Value.GetString(); |
| 0 | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | if (property.NameEquals("resourceId")) |
| | 52 | | { |
| 0 | 53 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 54 | | { |
| | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | resourceId = property.Value.GetString(); |
| 0 | 58 | | continue; |
| | 59 | | } |
| 0 | 60 | | if (property.NameEquals("address")) |
| | 61 | | { |
| 0 | 62 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 63 | | { |
| | 64 | | continue; |
| | 65 | | } |
| 0 | 66 | | address = property.Value.GetString(); |
| 0 | 67 | | continue; |
| | 68 | | } |
| 0 | 69 | | if (property.NameEquals("filter")) |
| | 70 | | { |
| 0 | 71 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 72 | | { |
| | 73 | | continue; |
| | 74 | | } |
| 0 | 75 | | filter = ConnectionMonitorEndpointFilter.DeserializeConnectionMonitorEndpointFilter(property.Value); |
| | 76 | | continue; |
| | 77 | | } |
| | 78 | | } |
| 0 | 79 | | return new ConnectionMonitorEndpoint(name, resourceId, address, filter); |
| | 80 | | } |
| | 81 | | } |
| | 82 | | } |