| | 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 RouteFilterRule : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (Name != null) |
| | 20 | | { |
| 8 | 21 | | writer.WritePropertyName("name"); |
| 8 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 16 | 24 | | if (Location != null) |
| | 25 | | { |
| 16 | 26 | | writer.WritePropertyName("location"); |
| 16 | 27 | | writer.WriteStringValue(Location); |
| | 28 | | } |
| 16 | 29 | | if (Etag != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("etag"); |
| 0 | 32 | | writer.WriteStringValue(Etag); |
| | 33 | | } |
| 16 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 16 | 39 | | writer.WritePropertyName("properties"); |
| 16 | 40 | | writer.WriteStartObject(); |
| 16 | 41 | | if (Access != null) |
| | 42 | | { |
| 16 | 43 | | writer.WritePropertyName("access"); |
| 16 | 44 | | writer.WriteStringValue(Access.Value.ToString()); |
| | 45 | | } |
| 16 | 46 | | if (RouteFilterRuleType != null) |
| | 47 | | { |
| 16 | 48 | | writer.WritePropertyName("routeFilterRuleType"); |
| 16 | 49 | | writer.WriteStringValue(RouteFilterRuleType); |
| | 50 | | } |
| 16 | 51 | | if (Communities != null) |
| | 52 | | { |
| 16 | 53 | | writer.WritePropertyName("communities"); |
| 16 | 54 | | writer.WriteStartArray(); |
| 64 | 55 | | foreach (var item in Communities) |
| | 56 | | { |
| 16 | 57 | | writer.WriteStringValue(item); |
| | 58 | | } |
| 16 | 59 | | writer.WriteEndArray(); |
| | 60 | | } |
| 16 | 61 | | if (ProvisioningState != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("provisioningState"); |
| 0 | 64 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 65 | | } |
| 16 | 66 | | writer.WriteEndObject(); |
| 16 | 67 | | writer.WriteEndObject(); |
| 16 | 68 | | } |
| | 69 | |
|
| | 70 | | internal static RouteFilterRule DeserializeRouteFilterRule(JsonElement element) |
| | 71 | | { |
| 16 | 72 | | string name = default; |
| 16 | 73 | | string location = default; |
| 16 | 74 | | string etag = default; |
| 16 | 75 | | string id = default; |
| 16 | 76 | | Access? access = default; |
| 16 | 77 | | string routeFilterRuleType = default; |
| 16 | 78 | | IList<string> communities = default; |
| 16 | 79 | | ProvisioningState? provisioningState = default; |
| 192 | 80 | | foreach (var property in element.EnumerateObject()) |
| | 81 | | { |
| 80 | 82 | | if (property.NameEquals("name")) |
| | 83 | | { |
| 16 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 16 | 88 | | name = property.Value.GetString(); |
| 16 | 89 | | continue; |
| | 90 | | } |
| 64 | 91 | | if (property.NameEquals("location")) |
| | 92 | | { |
| 0 | 93 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | location = property.Value.GetString(); |
| 0 | 98 | | continue; |
| | 99 | | } |
| 64 | 100 | | if (property.NameEquals("etag")) |
| | 101 | | { |
| 16 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 16 | 106 | | etag = property.Value.GetString(); |
| 16 | 107 | | continue; |
| | 108 | | } |
| 48 | 109 | | if (property.NameEquals("id")) |
| | 110 | | { |
| 16 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 16 | 115 | | id = property.Value.GetString(); |
| 16 | 116 | | continue; |
| | 117 | | } |
| 32 | 118 | | if (property.NameEquals("properties")) |
| | 119 | | { |
| 160 | 120 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 121 | | { |
| 64 | 122 | | if (property0.NameEquals("access")) |
| | 123 | | { |
| 16 | 124 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| | 126 | | continue; |
| | 127 | | } |
| 16 | 128 | | access = new Access(property0.Value.GetString()); |
| 16 | 129 | | continue; |
| | 130 | | } |
| 48 | 131 | | if (property0.NameEquals("routeFilterRuleType")) |
| | 132 | | { |
| 16 | 133 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 134 | | { |
| | 135 | | continue; |
| | 136 | | } |
| 16 | 137 | | routeFilterRuleType = property0.Value.GetString(); |
| 16 | 138 | | continue; |
| | 139 | | } |
| 32 | 140 | | if (property0.NameEquals("communities")) |
| | 141 | | { |
| 16 | 142 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 143 | | { |
| | 144 | | continue; |
| | 145 | | } |
| 16 | 146 | | List<string> array = new List<string>(); |
| 64 | 147 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 148 | | { |
| 16 | 149 | | if (item.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| 0 | 151 | | array.Add(null); |
| | 152 | | } |
| | 153 | | else |
| | 154 | | { |
| 16 | 155 | | array.Add(item.GetString()); |
| | 156 | | } |
| | 157 | | } |
| 16 | 158 | | communities = array; |
| 16 | 159 | | continue; |
| | 160 | | } |
| 16 | 161 | | if (property0.NameEquals("provisioningState")) |
| | 162 | | { |
| 16 | 163 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 16 | 167 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 168 | | continue; |
| | 169 | | } |
| | 170 | | } |
| | 171 | | continue; |
| | 172 | | } |
| | 173 | | } |
| 16 | 174 | | return new RouteFilterRule(id, name, location, etag, access, routeFilterRuleType, communities, provisioningS |
| | 175 | | } |
| | 176 | | } |
| | 177 | | } |