| | 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 ApplicationGatewayHttpListener : 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 (FrontendIPConfiguration != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("frontendIPConfiguration"); |
| 0 | 44 | | writer.WriteObjectValue(FrontendIPConfiguration); |
| | 45 | | } |
| 0 | 46 | | if (FrontendPort != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("frontendPort"); |
| 0 | 49 | | writer.WriteObjectValue(FrontendPort); |
| | 50 | | } |
| 0 | 51 | | if (Protocol != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("protocol"); |
| 0 | 54 | | writer.WriteStringValue(Protocol.Value.ToString()); |
| | 55 | | } |
| 0 | 56 | | if (HostName != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("hostName"); |
| 0 | 59 | | writer.WriteStringValue(HostName); |
| | 60 | | } |
| 0 | 61 | | if (SslCertificate != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("sslCertificate"); |
| 0 | 64 | | writer.WriteObjectValue(SslCertificate); |
| | 65 | | } |
| 0 | 66 | | if (RequireServerNameIndication != null) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("requireServerNameIndication"); |
| 0 | 69 | | writer.WriteBooleanValue(RequireServerNameIndication.Value); |
| | 70 | | } |
| 0 | 71 | | if (ProvisioningState != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("provisioningState"); |
| 0 | 74 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 75 | | } |
| 0 | 76 | | if (CustomErrorConfigurations != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("customErrorConfigurations"); |
| 0 | 79 | | writer.WriteStartArray(); |
| 0 | 80 | | foreach (var item in CustomErrorConfigurations) |
| | 81 | | { |
| 0 | 82 | | writer.WriteObjectValue(item); |
| | 83 | | } |
| 0 | 84 | | writer.WriteEndArray(); |
| | 85 | | } |
| 0 | 86 | | if (FirewallPolicy != null) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("firewallPolicy"); |
| 0 | 89 | | writer.WriteObjectValue(FirewallPolicy); |
| | 90 | | } |
| 0 | 91 | | if (HostNames != null) |
| | 92 | | { |
| 0 | 93 | | writer.WritePropertyName("hostNames"); |
| 0 | 94 | | writer.WriteStartArray(); |
| 0 | 95 | | foreach (var item in HostNames) |
| | 96 | | { |
| 0 | 97 | | writer.WriteStringValue(item); |
| | 98 | | } |
| 0 | 99 | | writer.WriteEndArray(); |
| | 100 | | } |
| 0 | 101 | | writer.WriteEndObject(); |
| 0 | 102 | | writer.WriteEndObject(); |
| 0 | 103 | | } |
| | 104 | |
|
| | 105 | | internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttpListener(JsonElement element) |
| | 106 | | { |
| 0 | 107 | | string name = default; |
| 0 | 108 | | string etag = default; |
| 0 | 109 | | string type = default; |
| 0 | 110 | | string id = default; |
| 0 | 111 | | SubResource frontendIPConfiguration = default; |
| 0 | 112 | | SubResource frontendPort = default; |
| 0 | 113 | | ApplicationGatewayProtocol? protocol = default; |
| 0 | 114 | | string hostName = default; |
| 0 | 115 | | SubResource sslCertificate = default; |
| 0 | 116 | | bool? requireServerNameIndication = default; |
| 0 | 117 | | ProvisioningState? provisioningState = default; |
| 0 | 118 | | IList<ApplicationGatewayCustomError> customErrorConfigurations = default; |
| 0 | 119 | | SubResource firewallPolicy = default; |
| 0 | 120 | | IList<string> hostNames = default; |
| 0 | 121 | | foreach (var property in element.EnumerateObject()) |
| | 122 | | { |
| 0 | 123 | | if (property.NameEquals("name")) |
| | 124 | | { |
| 0 | 125 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| | 127 | | continue; |
| | 128 | | } |
| 0 | 129 | | name = property.Value.GetString(); |
| 0 | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | if (property.NameEquals("etag")) |
| | 133 | | { |
| 0 | 134 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | etag = property.Value.GetString(); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("type")) |
| | 142 | | { |
| 0 | 143 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 144 | | { |
| | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | type = property.Value.GetString(); |
| 0 | 148 | | continue; |
| | 149 | | } |
| 0 | 150 | | if (property.NameEquals("id")) |
| | 151 | | { |
| 0 | 152 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 153 | | { |
| | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | id = property.Value.GetString(); |
| 0 | 157 | | continue; |
| | 158 | | } |
| 0 | 159 | | if (property.NameEquals("properties")) |
| | 160 | | { |
| 0 | 161 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 162 | | { |
| 0 | 163 | | if (property0.NameEquals("frontendIPConfiguration")) |
| | 164 | | { |
| 0 | 165 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 166 | | { |
| | 167 | | continue; |
| | 168 | | } |
| 0 | 169 | | frontendIPConfiguration = DeserializeSubResource(property0.Value); |
| 0 | 170 | | continue; |
| | 171 | | } |
| 0 | 172 | | if (property0.NameEquals("frontendPort")) |
| | 173 | | { |
| 0 | 174 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 175 | | { |
| | 176 | | continue; |
| | 177 | | } |
| 0 | 178 | | frontendPort = DeserializeSubResource(property0.Value); |
| 0 | 179 | | continue; |
| | 180 | | } |
| 0 | 181 | | if (property0.NameEquals("protocol")) |
| | 182 | | { |
| 0 | 183 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 184 | | { |
| | 185 | | continue; |
| | 186 | | } |
| 0 | 187 | | protocol = new ApplicationGatewayProtocol(property0.Value.GetString()); |
| 0 | 188 | | continue; |
| | 189 | | } |
| 0 | 190 | | if (property0.NameEquals("hostName")) |
| | 191 | | { |
| 0 | 192 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 193 | | { |
| | 194 | | continue; |
| | 195 | | } |
| 0 | 196 | | hostName = property0.Value.GetString(); |
| 0 | 197 | | continue; |
| | 198 | | } |
| 0 | 199 | | if (property0.NameEquals("sslCertificate")) |
| | 200 | | { |
| 0 | 201 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 202 | | { |
| | 203 | | continue; |
| | 204 | | } |
| 0 | 205 | | sslCertificate = DeserializeSubResource(property0.Value); |
| 0 | 206 | | continue; |
| | 207 | | } |
| 0 | 208 | | if (property0.NameEquals("requireServerNameIndication")) |
| | 209 | | { |
| 0 | 210 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| | 212 | | continue; |
| | 213 | | } |
| 0 | 214 | | requireServerNameIndication = property0.Value.GetBoolean(); |
| 0 | 215 | | continue; |
| | 216 | | } |
| 0 | 217 | | if (property0.NameEquals("provisioningState")) |
| | 218 | | { |
| 0 | 219 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 220 | | { |
| | 221 | | continue; |
| | 222 | | } |
| 0 | 223 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 224 | | continue; |
| | 225 | | } |
| 0 | 226 | | if (property0.NameEquals("customErrorConfigurations")) |
| | 227 | | { |
| 0 | 228 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 229 | | { |
| | 230 | | continue; |
| | 231 | | } |
| 0 | 232 | | List<ApplicationGatewayCustomError> array = new List<ApplicationGatewayCustomError>(); |
| 0 | 233 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 234 | | { |
| 0 | 235 | | if (item.ValueKind == JsonValueKind.Null) |
| | 236 | | { |
| 0 | 237 | | array.Add(null); |
| | 238 | | } |
| | 239 | | else |
| | 240 | | { |
| 0 | 241 | | array.Add(ApplicationGatewayCustomError.DeserializeApplicationGatewayCustomError(ite |
| | 242 | | } |
| | 243 | | } |
| 0 | 244 | | customErrorConfigurations = array; |
| 0 | 245 | | continue; |
| | 246 | | } |
| 0 | 247 | | if (property0.NameEquals("firewallPolicy")) |
| | 248 | | { |
| 0 | 249 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 250 | | { |
| | 251 | | continue; |
| | 252 | | } |
| 0 | 253 | | firewallPolicy = DeserializeSubResource(property0.Value); |
| 0 | 254 | | continue; |
| | 255 | | } |
| 0 | 256 | | if (property0.NameEquals("hostNames")) |
| | 257 | | { |
| 0 | 258 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 259 | | { |
| | 260 | | continue; |
| | 261 | | } |
| 0 | 262 | | List<string> array = new List<string>(); |
| 0 | 263 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 264 | | { |
| 0 | 265 | | if (item.ValueKind == JsonValueKind.Null) |
| | 266 | | { |
| 0 | 267 | | array.Add(null); |
| | 268 | | } |
| | 269 | | else |
| | 270 | | { |
| 0 | 271 | | array.Add(item.GetString()); |
| | 272 | | } |
| | 273 | | } |
| 0 | 274 | | hostNames = array; |
| | 275 | | continue; |
| | 276 | | } |
| | 277 | | } |
| | 278 | | continue; |
| | 279 | | } |
| | 280 | | } |
| 0 | 281 | | return new ApplicationGatewayHttpListener(id, name, etag, type, frontendIPConfiguration, frontendPort, proto |
| | 282 | | } |
| | 283 | | } |
| | 284 | | } |