| | 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 ApplicationGatewayRequestRoutingRule : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Name != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 0 | 23 | | if (Etag != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("etag"); |
| 0 | 26 | | writer.WriteStringValue(Etag); |
| | 27 | | } |
| 0 | 28 | | if (Type != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("type"); |
| 0 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 0 | 33 | | if (Id != null) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName("id"); |
| 0 | 36 | | writer.WriteStringValue(Id); |
| | 37 | | } |
| 0 | 38 | | writer.WritePropertyName("properties"); |
| 0 | 39 | | writer.WriteStartObject(); |
| 0 | 40 | | if (RuleType != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("ruleType"); |
| 0 | 43 | | writer.WriteStringValue(RuleType.Value.ToString()); |
| | 44 | | } |
| 0 | 45 | | if (Priority != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("priority"); |
| 0 | 48 | | writer.WriteNumberValue(Priority.Value); |
| | 49 | | } |
| 0 | 50 | | if (BackendAddressPool != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("backendAddressPool"); |
| 0 | 53 | | writer.WriteObjectValue(BackendAddressPool); |
| | 54 | | } |
| 0 | 55 | | if (BackendHttpSettings != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("backendHttpSettings"); |
| 0 | 58 | | writer.WriteObjectValue(BackendHttpSettings); |
| | 59 | | } |
| 0 | 60 | | if (HttpListener != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("httpListener"); |
| 0 | 63 | | writer.WriteObjectValue(HttpListener); |
| | 64 | | } |
| 0 | 65 | | if (UrlPathMap != null) |
| | 66 | | { |
| 0 | 67 | | writer.WritePropertyName("urlPathMap"); |
| 0 | 68 | | writer.WriteObjectValue(UrlPathMap); |
| | 69 | | } |
| 0 | 70 | | if (RewriteRuleSet != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("rewriteRuleSet"); |
| 0 | 73 | | writer.WriteObjectValue(RewriteRuleSet); |
| | 74 | | } |
| 0 | 75 | | if (RedirectConfiguration != null) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName("redirectConfiguration"); |
| 0 | 78 | | writer.WriteObjectValue(RedirectConfiguration); |
| | 79 | | } |
| 0 | 80 | | if (ProvisioningState != null) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("provisioningState"); |
| 0 | 83 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndObject(); |
| 0 | 86 | | writer.WriteEndObject(); |
| 0 | 87 | | } |
| | 88 | |
|
| | 89 | | internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatewayRequestRoutingRule(JsonElement |
| | 90 | | { |
| 0 | 91 | | string name = default; |
| 0 | 92 | | string etag = default; |
| 0 | 93 | | string type = default; |
| 0 | 94 | | string id = default; |
| 0 | 95 | | ApplicationGatewayRequestRoutingRuleType? ruleType = default; |
| 0 | 96 | | int? priority = default; |
| 0 | 97 | | SubResource backendAddressPool = default; |
| 0 | 98 | | SubResource backendHttpSettings = default; |
| 0 | 99 | | SubResource httpListener = default; |
| 0 | 100 | | SubResource urlPathMap = default; |
| 0 | 101 | | SubResource rewriteRuleSet = default; |
| 0 | 102 | | SubResource redirectConfiguration = default; |
| 0 | 103 | | ProvisioningState? provisioningState = default; |
| 0 | 104 | | foreach (var property in element.EnumerateObject()) |
| | 105 | | { |
| 0 | 106 | | if (property.NameEquals("name")) |
| | 107 | | { |
| 0 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | name = property.Value.GetString(); |
| 0 | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | if (property.NameEquals("etag")) |
| | 116 | | { |
| 0 | 117 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 118 | | { |
| | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | etag = property.Value.GetString(); |
| 0 | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | if (property.NameEquals("type")) |
| | 125 | | { |
| 0 | 126 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| | 128 | | continue; |
| | 129 | | } |
| 0 | 130 | | type = property.Value.GetString(); |
| 0 | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | if (property.NameEquals("id")) |
| | 134 | | { |
| 0 | 135 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 136 | | { |
| | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | id = property.Value.GetString(); |
| 0 | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | if (property.NameEquals("properties")) |
| | 143 | | { |
| 0 | 144 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 145 | | { |
| 0 | 146 | | if (property0.NameEquals("ruleType")) |
| | 147 | | { |
| 0 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | ruleType = new ApplicationGatewayRequestRoutingRuleType(property0.Value.GetString()); |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property0.NameEquals("priority")) |
| | 156 | | { |
| 0 | 157 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | priority = property0.Value.GetInt32(); |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property0.NameEquals("backendAddressPool")) |
| | 165 | | { |
| 0 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | backendAddressPool = DeserializeSubResource(property0.Value); |
| 0 | 171 | | continue; |
| | 172 | | } |
| 0 | 173 | | if (property0.NameEquals("backendHttpSettings")) |
| | 174 | | { |
| 0 | 175 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | backendHttpSettings = DeserializeSubResource(property0.Value); |
| 0 | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | if (property0.NameEquals("httpListener")) |
| | 183 | | { |
| 0 | 184 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | httpListener = DeserializeSubResource(property0.Value); |
| 0 | 189 | | continue; |
| | 190 | | } |
| 0 | 191 | | if (property0.NameEquals("urlPathMap")) |
| | 192 | | { |
| 0 | 193 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | urlPathMap = DeserializeSubResource(property0.Value); |
| 0 | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | if (property0.NameEquals("rewriteRuleSet")) |
| | 201 | | { |
| 0 | 202 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 0 | 206 | | rewriteRuleSet = DeserializeSubResource(property0.Value); |
| 0 | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | if (property0.NameEquals("redirectConfiguration")) |
| | 210 | | { |
| 0 | 211 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 0 | 215 | | redirectConfiguration = DeserializeSubResource(property0.Value); |
| 0 | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | if (property0.NameEquals("provisioningState")) |
| | 219 | | { |
| 0 | 220 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 221 | | { |
| | 222 | | continue; |
| | 223 | | } |
| 0 | 224 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 225 | | continue; |
| | 226 | | } |
| | 227 | | } |
| | 228 | | continue; |
| | 229 | | } |
| | 230 | | } |
| 0 | 231 | | return new ApplicationGatewayRequestRoutingRule(id, name, etag, type, ruleType, priority, backendAddressPool |
| | 232 | | } |
| | 233 | | } |
| | 234 | | } |