| | 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 ApplicationGatewayRewriteRuleActionSet : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (RequestHeaderConfigurations != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("requestHeaderConfigurations"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in RequestHeaderConfigurations) |
| | 24 | | { |
| 0 | 25 | | writer.WriteObjectValue(item); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | if (ResponseHeaderConfigurations != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("responseHeaderConfigurations"); |
| 0 | 32 | | writer.WriteStartArray(); |
| 0 | 33 | | foreach (var item in ResponseHeaderConfigurations) |
| | 34 | | { |
| 0 | 35 | | writer.WriteObjectValue(item); |
| | 36 | | } |
| 0 | 37 | | writer.WriteEndArray(); |
| | 38 | | } |
| 0 | 39 | | if (UrlConfiguration != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("urlConfiguration"); |
| 0 | 42 | | writer.WriteObjectValue(UrlConfiguration); |
| | 43 | | } |
| 0 | 44 | | writer.WriteEndObject(); |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static ApplicationGatewayRewriteRuleActionSet DeserializeApplicationGatewayRewriteRuleActionSet(JsonEle |
| | 48 | | { |
| 0 | 49 | | IList<ApplicationGatewayHeaderConfiguration> requestHeaderConfigurations = default; |
| 0 | 50 | | IList<ApplicationGatewayHeaderConfiguration> responseHeaderConfigurations = default; |
| 0 | 51 | | ApplicationGatewayUrlConfiguration urlConfiguration = default; |
| 0 | 52 | | foreach (var property in element.EnumerateObject()) |
| | 53 | | { |
| 0 | 54 | | if (property.NameEquals("requestHeaderConfigurations")) |
| | 55 | | { |
| 0 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 0 | 60 | | List<ApplicationGatewayHeaderConfiguration> array = new List<ApplicationGatewayHeaderConfiguration>( |
| 0 | 61 | | foreach (var item in property.Value.EnumerateArray()) |
| | 62 | | { |
| 0 | 63 | | if (item.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| 0 | 65 | | array.Add(null); |
| | 66 | | } |
| | 67 | | else |
| | 68 | | { |
| 0 | 69 | | array.Add(ApplicationGatewayHeaderConfiguration.DeserializeApplicationGatewayHeaderConfigura |
| | 70 | | } |
| | 71 | | } |
| 0 | 72 | | requestHeaderConfigurations = array; |
| 0 | 73 | | continue; |
| | 74 | | } |
| 0 | 75 | | if (property.NameEquals("responseHeaderConfigurations")) |
| | 76 | | { |
| 0 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | List<ApplicationGatewayHeaderConfiguration> array = new List<ApplicationGatewayHeaderConfiguration>( |
| 0 | 82 | | foreach (var item in property.Value.EnumerateArray()) |
| | 83 | | { |
| 0 | 84 | | if (item.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| 0 | 86 | | array.Add(null); |
| | 87 | | } |
| | 88 | | else |
| | 89 | | { |
| 0 | 90 | | array.Add(ApplicationGatewayHeaderConfiguration.DeserializeApplicationGatewayHeaderConfigura |
| | 91 | | } |
| | 92 | | } |
| 0 | 93 | | responseHeaderConfigurations = array; |
| 0 | 94 | | continue; |
| | 95 | | } |
| 0 | 96 | | if (property.NameEquals("urlConfiguration")) |
| | 97 | | { |
| 0 | 98 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 99 | | { |
| | 100 | | continue; |
| | 101 | | } |
| 0 | 102 | | urlConfiguration = ApplicationGatewayUrlConfiguration.DeserializeApplicationGatewayUrlConfiguration( |
| | 103 | | continue; |
| | 104 | | } |
| | 105 | | } |
| 0 | 106 | | return new ApplicationGatewayRewriteRuleActionSet(requestHeaderConfigurations, responseHeaderConfigurations, |
| | 107 | | } |
| | 108 | | } |
| | 109 | | } |