| | 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 ApplicationGatewayBackendHttpSettings : 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 (Port != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("port"); |
| 0 | 44 | | writer.WriteNumberValue(Port.Value); |
| | 45 | | } |
| 0 | 46 | | if (Protocol != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("protocol"); |
| 0 | 49 | | writer.WriteStringValue(Protocol.Value.ToString()); |
| | 50 | | } |
| 0 | 51 | | if (CookieBasedAffinity != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("cookieBasedAffinity"); |
| 0 | 54 | | writer.WriteStringValue(CookieBasedAffinity.Value.ToString()); |
| | 55 | | } |
| 0 | 56 | | if (RequestTimeout != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("requestTimeout"); |
| 0 | 59 | | writer.WriteNumberValue(RequestTimeout.Value); |
| | 60 | | } |
| 0 | 61 | | if (Probe != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("probe"); |
| 0 | 64 | | writer.WriteObjectValue(Probe); |
| | 65 | | } |
| 0 | 66 | | if (AuthenticationCertificates != null) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("authenticationCertificates"); |
| 0 | 69 | | writer.WriteStartArray(); |
| 0 | 70 | | foreach (var item in AuthenticationCertificates) |
| | 71 | | { |
| 0 | 72 | | writer.WriteObjectValue(item); |
| | 73 | | } |
| 0 | 74 | | writer.WriteEndArray(); |
| | 75 | | } |
| 0 | 76 | | if (TrustedRootCertificates != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("trustedRootCertificates"); |
| 0 | 79 | | writer.WriteStartArray(); |
| 0 | 80 | | foreach (var item in TrustedRootCertificates) |
| | 81 | | { |
| 0 | 82 | | writer.WriteObjectValue(item); |
| | 83 | | } |
| 0 | 84 | | writer.WriteEndArray(); |
| | 85 | | } |
| 0 | 86 | | if (ConnectionDraining != null) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("connectionDraining"); |
| 0 | 89 | | writer.WriteObjectValue(ConnectionDraining); |
| | 90 | | } |
| 0 | 91 | | if (HostName != null) |
| | 92 | | { |
| 0 | 93 | | writer.WritePropertyName("hostName"); |
| 0 | 94 | | writer.WriteStringValue(HostName); |
| | 95 | | } |
| 0 | 96 | | if (PickHostNameFromBackendAddress != null) |
| | 97 | | { |
| 0 | 98 | | writer.WritePropertyName("pickHostNameFromBackendAddress"); |
| 0 | 99 | | writer.WriteBooleanValue(PickHostNameFromBackendAddress.Value); |
| | 100 | | } |
| 0 | 101 | | if (AffinityCookieName != null) |
| | 102 | | { |
| 0 | 103 | | writer.WritePropertyName("affinityCookieName"); |
| 0 | 104 | | writer.WriteStringValue(AffinityCookieName); |
| | 105 | | } |
| 0 | 106 | | if (ProbeEnabled != null) |
| | 107 | | { |
| 0 | 108 | | writer.WritePropertyName("probeEnabled"); |
| 0 | 109 | | writer.WriteBooleanValue(ProbeEnabled.Value); |
| | 110 | | } |
| 0 | 111 | | if (Path != null) |
| | 112 | | { |
| 0 | 113 | | writer.WritePropertyName("path"); |
| 0 | 114 | | writer.WriteStringValue(Path); |
| | 115 | | } |
| 0 | 116 | | if (ProvisioningState != null) |
| | 117 | | { |
| 0 | 118 | | writer.WritePropertyName("provisioningState"); |
| 0 | 119 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 120 | | } |
| 0 | 121 | | writer.WriteEndObject(); |
| 0 | 122 | | writer.WriteEndObject(); |
| 0 | 123 | | } |
| | 124 | |
|
| | 125 | | internal static ApplicationGatewayBackendHttpSettings DeserializeApplicationGatewayBackendHttpSettings(JsonEleme |
| | 126 | | { |
| 0 | 127 | | string name = default; |
| 0 | 128 | | string etag = default; |
| 0 | 129 | | string type = default; |
| 0 | 130 | | string id = default; |
| 0 | 131 | | int? port = default; |
| 0 | 132 | | ApplicationGatewayProtocol? protocol = default; |
| 0 | 133 | | ApplicationGatewayCookieBasedAffinity? cookieBasedAffinity = default; |
| 0 | 134 | | int? requestTimeout = default; |
| 0 | 135 | | SubResource probe = default; |
| 0 | 136 | | IList<SubResource> authenticationCertificates = default; |
| 0 | 137 | | IList<SubResource> trustedRootCertificates = default; |
| 0 | 138 | | ApplicationGatewayConnectionDraining connectionDraining = default; |
| 0 | 139 | | string hostName = default; |
| 0 | 140 | | bool? pickHostNameFromBackendAddress = default; |
| 0 | 141 | | string affinityCookieName = default; |
| 0 | 142 | | bool? probeEnabled = default; |
| 0 | 143 | | string path = default; |
| 0 | 144 | | ProvisioningState? provisioningState = default; |
| 0 | 145 | | foreach (var property in element.EnumerateObject()) |
| | 146 | | { |
| 0 | 147 | | if (property.NameEquals("name")) |
| | 148 | | { |
| 0 | 149 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | name = property.Value.GetString(); |
| 0 | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | if (property.NameEquals("etag")) |
| | 157 | | { |
| 0 | 158 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 0 | 162 | | etag = property.Value.GetString(); |
| 0 | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | if (property.NameEquals("type")) |
| | 166 | | { |
| 0 | 167 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | type = property.Value.GetString(); |
| 0 | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | if (property.NameEquals("id")) |
| | 175 | | { |
| 0 | 176 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | id = property.Value.GetString(); |
| 0 | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | if (property.NameEquals("properties")) |
| | 184 | | { |
| 0 | 185 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 186 | | { |
| 0 | 187 | | if (property0.NameEquals("port")) |
| | 188 | | { |
| 0 | 189 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| | 191 | | continue; |
| | 192 | | } |
| 0 | 193 | | port = property0.Value.GetInt32(); |
| 0 | 194 | | continue; |
| | 195 | | } |
| 0 | 196 | | if (property0.NameEquals("protocol")) |
| | 197 | | { |
| 0 | 198 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 199 | | { |
| | 200 | | continue; |
| | 201 | | } |
| 0 | 202 | | protocol = new ApplicationGatewayProtocol(property0.Value.GetString()); |
| 0 | 203 | | continue; |
| | 204 | | } |
| 0 | 205 | | if (property0.NameEquals("cookieBasedAffinity")) |
| | 206 | | { |
| 0 | 207 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 208 | | { |
| | 209 | | continue; |
| | 210 | | } |
| 0 | 211 | | cookieBasedAffinity = new ApplicationGatewayCookieBasedAffinity(property0.Value.GetString()) |
| 0 | 212 | | continue; |
| | 213 | | } |
| 0 | 214 | | if (property0.NameEquals("requestTimeout")) |
| | 215 | | { |
| 0 | 216 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 217 | | { |
| | 218 | | continue; |
| | 219 | | } |
| 0 | 220 | | requestTimeout = property0.Value.GetInt32(); |
| 0 | 221 | | continue; |
| | 222 | | } |
| 0 | 223 | | if (property0.NameEquals("probe")) |
| | 224 | | { |
| 0 | 225 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 226 | | { |
| | 227 | | continue; |
| | 228 | | } |
| 0 | 229 | | probe = DeserializeSubResource(property0.Value); |
| 0 | 230 | | continue; |
| | 231 | | } |
| 0 | 232 | | if (property0.NameEquals("authenticationCertificates")) |
| | 233 | | { |
| 0 | 234 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 235 | | { |
| | 236 | | continue; |
| | 237 | | } |
| 0 | 238 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 239 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 240 | | { |
| 0 | 241 | | if (item.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| 0 | 243 | | array.Add(null); |
| | 244 | | } |
| | 245 | | else |
| | 246 | | { |
| 0 | 247 | | array.Add(DeserializeSubResource(item)); |
| | 248 | | } |
| | 249 | | } |
| 0 | 250 | | authenticationCertificates = array; |
| 0 | 251 | | continue; |
| | 252 | | } |
| 0 | 253 | | if (property0.NameEquals("trustedRootCertificates")) |
| | 254 | | { |
| 0 | 255 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 256 | | { |
| | 257 | | continue; |
| | 258 | | } |
| 0 | 259 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 260 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 261 | | { |
| 0 | 262 | | if (item.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| 0 | 264 | | array.Add(null); |
| | 265 | | } |
| | 266 | | else |
| | 267 | | { |
| 0 | 268 | | array.Add(DeserializeSubResource(item)); |
| | 269 | | } |
| | 270 | | } |
| 0 | 271 | | trustedRootCertificates = array; |
| 0 | 272 | | continue; |
| | 273 | | } |
| 0 | 274 | | if (property0.NameEquals("connectionDraining")) |
| | 275 | | { |
| 0 | 276 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 277 | | { |
| | 278 | | continue; |
| | 279 | | } |
| 0 | 280 | | connectionDraining = ApplicationGatewayConnectionDraining.DeserializeApplicationGatewayConne |
| 0 | 281 | | continue; |
| | 282 | | } |
| 0 | 283 | | if (property0.NameEquals("hostName")) |
| | 284 | | { |
| 0 | 285 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 286 | | { |
| | 287 | | continue; |
| | 288 | | } |
| 0 | 289 | | hostName = property0.Value.GetString(); |
| 0 | 290 | | continue; |
| | 291 | | } |
| 0 | 292 | | if (property0.NameEquals("pickHostNameFromBackendAddress")) |
| | 293 | | { |
| 0 | 294 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 295 | | { |
| | 296 | | continue; |
| | 297 | | } |
| 0 | 298 | | pickHostNameFromBackendAddress = property0.Value.GetBoolean(); |
| 0 | 299 | | continue; |
| | 300 | | } |
| 0 | 301 | | if (property0.NameEquals("affinityCookieName")) |
| | 302 | | { |
| 0 | 303 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 304 | | { |
| | 305 | | continue; |
| | 306 | | } |
| 0 | 307 | | affinityCookieName = property0.Value.GetString(); |
| 0 | 308 | | continue; |
| | 309 | | } |
| 0 | 310 | | if (property0.NameEquals("probeEnabled")) |
| | 311 | | { |
| 0 | 312 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 313 | | { |
| | 314 | | continue; |
| | 315 | | } |
| 0 | 316 | | probeEnabled = property0.Value.GetBoolean(); |
| 0 | 317 | | continue; |
| | 318 | | } |
| 0 | 319 | | if (property0.NameEquals("path")) |
| | 320 | | { |
| 0 | 321 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 322 | | { |
| | 323 | | continue; |
| | 324 | | } |
| 0 | 325 | | path = property0.Value.GetString(); |
| 0 | 326 | | continue; |
| | 327 | | } |
| 0 | 328 | | if (property0.NameEquals("provisioningState")) |
| | 329 | | { |
| 0 | 330 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 331 | | { |
| | 332 | | continue; |
| | 333 | | } |
| 0 | 334 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 335 | | continue; |
| | 336 | | } |
| | 337 | | } |
| | 338 | | continue; |
| | 339 | | } |
| | 340 | | } |
| 0 | 341 | | return new ApplicationGatewayBackendHttpSettings(id, name, etag, type, port, protocol, cookieBasedAffinity, |
| | 342 | | } |
| | 343 | | } |
| | 344 | | } |