| | 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 NWRuleSetIpRules : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 20 | 17 | | writer.WriteStartObject(); |
| 20 | 18 | | if (IpMask != null) |
| | 19 | | { |
| 20 | 20 | | writer.WritePropertyName("ipMask"); |
| 20 | 21 | | writer.WriteStringValue(IpMask); |
| | 22 | | } |
| 20 | 23 | | if (Action != null) |
| | 24 | | { |
| 20 | 25 | | writer.WritePropertyName("action"); |
| 20 | 26 | | writer.WriteStringValue(Action); |
| | 27 | | } |
| 20 | 28 | | writer.WriteEndObject(); |
| 20 | 29 | | } |
| | 30 | |
|
| | 31 | | internal static NWRuleSetIpRules DeserializeNWRuleSetIpRules(JsonElement element) |
| | 32 | | { |
| 40 | 33 | | string ipMask = default; |
| 40 | 34 | | string action = default; |
| 240 | 35 | | foreach (var property in element.EnumerateObject()) |
| | 36 | | { |
| 80 | 37 | | if (property.NameEquals("ipMask")) |
| | 38 | | { |
| 40 | 39 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 40 | | { |
| | 41 | | continue; |
| | 42 | | } |
| 40 | 43 | | ipMask = property.Value.GetString(); |
| 40 | 44 | | continue; |
| | 45 | | } |
| 40 | 46 | | if (property.NameEquals("action")) |
| | 47 | | { |
| 40 | 48 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 49 | | { |
| | 50 | | continue; |
| | 51 | | } |
| 40 | 52 | | action = property.Value.GetString(); |
| | 53 | | continue; |
| | 54 | | } |
| | 55 | | } |
| 40 | 56 | | return new NWRuleSetIpRules(ipMask, action); |
| | 57 | | } |
| | 58 | | } |
| | 59 | | } |