| | 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 ApplicationGatewayRedirectConfiguration : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Etag != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("etag"); |
| 0 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | writer.WritePropertyName("properties"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | if (RedirectType != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("redirectType"); |
| 0 | 44 | | writer.WriteStringValue(RedirectType.Value.ToString()); |
| | 45 | | } |
| 0 | 46 | | if (TargetListener != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("targetListener"); |
| 0 | 49 | | writer.WriteObjectValue(TargetListener); |
| | 50 | | } |
| 0 | 51 | | if (TargetUrl != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("targetUrl"); |
| 0 | 54 | | writer.WriteStringValue(TargetUrl); |
| | 55 | | } |
| 0 | 56 | | if (IncludePath != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("includePath"); |
| 0 | 59 | | writer.WriteBooleanValue(IncludePath.Value); |
| | 60 | | } |
| 0 | 61 | | if (IncludeQueryString != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("includeQueryString"); |
| 0 | 64 | | writer.WriteBooleanValue(IncludeQueryString.Value); |
| | 65 | | } |
| 0 | 66 | | if (RequestRoutingRules != null) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("requestRoutingRules"); |
| 0 | 69 | | writer.WriteStartArray(); |
| 0 | 70 | | foreach (var item in RequestRoutingRules) |
| | 71 | | { |
| 0 | 72 | | writer.WriteObjectValue(item); |
| | 73 | | } |
| 0 | 74 | | writer.WriteEndArray(); |
| | 75 | | } |
| 0 | 76 | | if (UrlPathMaps != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("urlPathMaps"); |
| 0 | 79 | | writer.WriteStartArray(); |
| 0 | 80 | | foreach (var item in UrlPathMaps) |
| | 81 | | { |
| 0 | 82 | | writer.WriteObjectValue(item); |
| | 83 | | } |
| 0 | 84 | | writer.WriteEndArray(); |
| | 85 | | } |
| 0 | 86 | | if (PathRules != null) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("pathRules"); |
| 0 | 89 | | writer.WriteStartArray(); |
| 0 | 90 | | foreach (var item in PathRules) |
| | 91 | | { |
| 0 | 92 | | writer.WriteObjectValue(item); |
| | 93 | | } |
| 0 | 94 | | writer.WriteEndArray(); |
| | 95 | | } |
| 0 | 96 | | writer.WriteEndObject(); |
| 0 | 97 | | writer.WriteEndObject(); |
| 0 | 98 | | } |
| | 99 | |
|
| | 100 | | internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGatewayRedirectConfiguration(JsonE |
| | 101 | | { |
| 0 | 102 | | string name = default; |
| 0 | 103 | | string etag = default; |
| 0 | 104 | | string type = default; |
| 0 | 105 | | string id = default; |
| 0 | 106 | | ApplicationGatewayRedirectType? redirectType = default; |
| 0 | 107 | | SubResource targetListener = default; |
| 0 | 108 | | string targetUrl = default; |
| 0 | 109 | | bool? includePath = default; |
| 0 | 110 | | bool? includeQueryString = default; |
| 0 | 111 | | IList<SubResource> requestRoutingRules = default; |
| 0 | 112 | | IList<SubResource> urlPathMaps = default; |
| 0 | 113 | | IList<SubResource> pathRules = default; |
| 0 | 114 | | foreach (var property in element.EnumerateObject()) |
| | 115 | | { |
| 0 | 116 | | if (property.NameEquals("name")) |
| | 117 | | { |
| 0 | 118 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | name = property.Value.GetString(); |
| 0 | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | if (property.NameEquals("etag")) |
| | 126 | | { |
| 0 | 127 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | etag = property.Value.GetString(); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property.NameEquals("type")) |
| | 135 | | { |
| 0 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | type = property.Value.GetString(); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property.NameEquals("id")) |
| | 144 | | { |
| 0 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | id = property.Value.GetString(); |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property.NameEquals("properties")) |
| | 153 | | { |
| 0 | 154 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 155 | | { |
| 0 | 156 | | if (property0.NameEquals("redirectType")) |
| | 157 | | { |
| 0 | 158 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 0 | 162 | | redirectType = new ApplicationGatewayRedirectType(property0.Value.GetString()); |
| 0 | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | if (property0.NameEquals("targetListener")) |
| | 166 | | { |
| 0 | 167 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | targetListener = DeserializeSubResource(property0.Value); |
| 0 | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | if (property0.NameEquals("targetUrl")) |
| | 175 | | { |
| 0 | 176 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | targetUrl = property0.Value.GetString(); |
| 0 | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | if (property0.NameEquals("includePath")) |
| | 184 | | { |
| 0 | 185 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 186 | | { |
| | 187 | | continue; |
| | 188 | | } |
| 0 | 189 | | includePath = property0.Value.GetBoolean(); |
| 0 | 190 | | continue; |
| | 191 | | } |
| 0 | 192 | | if (property0.NameEquals("includeQueryString")) |
| | 193 | | { |
| 0 | 194 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | includeQueryString = property0.Value.GetBoolean(); |
| 0 | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | if (property0.NameEquals("requestRoutingRules")) |
| | 202 | | { |
| 0 | 203 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 0 | 207 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 208 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 209 | | { |
| 0 | 210 | | if (item.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| 0 | 212 | | array.Add(null); |
| | 213 | | } |
| | 214 | | else |
| | 215 | | { |
| 0 | 216 | | array.Add(DeserializeSubResource(item)); |
| | 217 | | } |
| | 218 | | } |
| 0 | 219 | | requestRoutingRules = array; |
| 0 | 220 | | continue; |
| | 221 | | } |
| 0 | 222 | | if (property0.NameEquals("urlPathMaps")) |
| | 223 | | { |
| 0 | 224 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 225 | | { |
| | 226 | | continue; |
| | 227 | | } |
| 0 | 228 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 229 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 230 | | { |
| 0 | 231 | | if (item.ValueKind == JsonValueKind.Null) |
| | 232 | | { |
| 0 | 233 | | array.Add(null); |
| | 234 | | } |
| | 235 | | else |
| | 236 | | { |
| 0 | 237 | | array.Add(DeserializeSubResource(item)); |
| | 238 | | } |
| | 239 | | } |
| 0 | 240 | | urlPathMaps = array; |
| 0 | 241 | | continue; |
| | 242 | | } |
| 0 | 243 | | if (property0.NameEquals("pathRules")) |
| | 244 | | { |
| 0 | 245 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 246 | | { |
| | 247 | | continue; |
| | 248 | | } |
| 0 | 249 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 250 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 251 | | { |
| 0 | 252 | | if (item.ValueKind == JsonValueKind.Null) |
| | 253 | | { |
| 0 | 254 | | array.Add(null); |
| | 255 | | } |
| | 256 | | else |
| | 257 | | { |
| 0 | 258 | | array.Add(DeserializeSubResource(item)); |
| | 259 | | } |
| | 260 | | } |
| 0 | 261 | | pathRules = array; |
| | 262 | | continue; |
| | 263 | | } |
| | 264 | | } |
| | 265 | | continue; |
| | 266 | | } |
| | 267 | | } |
| 0 | 268 | | return new ApplicationGatewayRedirectConfiguration(id, name, etag, type, redirectType, targetListener, targe |
| | 269 | | } |
| | 270 | | } |
| | 271 | | } |