| | 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 MatchVariable : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("variableName"); |
| 0 | 19 | | writer.WriteStringValue(VariableName.ToString()); |
| 0 | 20 | | if (Selector != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("selector"); |
| 0 | 23 | | writer.WriteStringValue(Selector); |
| | 24 | | } |
| 0 | 25 | | writer.WriteEndObject(); |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | internal static MatchVariable DeserializeMatchVariable(JsonElement element) |
| | 29 | | { |
| 0 | 30 | | WebApplicationFirewallMatchVariable variableName = default; |
| 0 | 31 | | string selector = default; |
| 0 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 0 | 34 | | if (property.NameEquals("variableName")) |
| | 35 | | { |
| 0 | 36 | | variableName = new WebApplicationFirewallMatchVariable(property.Value.GetString()); |
| 0 | 37 | | continue; |
| | 38 | | } |
| 0 | 39 | | if (property.NameEquals("selector")) |
| | 40 | | { |
| 0 | 41 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 42 | | { |
| | 43 | | continue; |
| | 44 | | } |
| 0 | 45 | | selector = property.Value.GetString(); |
| | 46 | | continue; |
| | 47 | | } |
| | 48 | | } |
| 0 | 49 | | return new MatchVariable(variableName, selector); |
| | 50 | | } |
| | 51 | | } |
| | 52 | | } |