| | 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 LoadBalancingRule : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 80 | 17 | | writer.WriteStartObject(); |
| 80 | 18 | | if (Name != null) |
| | 19 | | { |
| 80 | 20 | | writer.WritePropertyName("name"); |
| 80 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 80 | 23 | | if (Etag != null) |
| | 24 | | { |
| 8 | 25 | | writer.WritePropertyName("etag"); |
| 8 | 26 | | writer.WriteStringValue(Etag); |
| | 27 | | } |
| 80 | 28 | | if (Type != null) |
| | 29 | | { |
| 8 | 30 | | writer.WritePropertyName("type"); |
| 8 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 80 | 33 | | if (Id != null) |
| | 34 | | { |
| 8 | 35 | | writer.WritePropertyName("id"); |
| 8 | 36 | | writer.WriteStringValue(Id); |
| | 37 | | } |
| 80 | 38 | | writer.WritePropertyName("properties"); |
| 80 | 39 | | writer.WriteStartObject(); |
| 80 | 40 | | if (FrontendIPConfiguration != null) |
| | 41 | | { |
| 80 | 42 | | writer.WritePropertyName("frontendIPConfiguration"); |
| 80 | 43 | | writer.WriteObjectValue(FrontendIPConfiguration); |
| | 44 | | } |
| 80 | 45 | | if (BackendAddressPool != null) |
| | 46 | | { |
| 80 | 47 | | writer.WritePropertyName("backendAddressPool"); |
| 80 | 48 | | writer.WriteObjectValue(BackendAddressPool); |
| | 49 | | } |
| 80 | 50 | | if (Probe != null) |
| | 51 | | { |
| 72 | 52 | | writer.WritePropertyName("probe"); |
| 72 | 53 | | writer.WriteObjectValue(Probe); |
| | 54 | | } |
| 80 | 55 | | if (Protocol != null) |
| | 56 | | { |
| 80 | 57 | | writer.WritePropertyName("protocol"); |
| 80 | 58 | | writer.WriteStringValue(Protocol.Value.ToString()); |
| | 59 | | } |
| 80 | 60 | | if (LoadDistribution != null) |
| | 61 | | { |
| 24 | 62 | | writer.WritePropertyName("loadDistribution"); |
| 24 | 63 | | writer.WriteStringValue(LoadDistribution.Value.ToString()); |
| | 64 | | } |
| 80 | 65 | | if (FrontendPort != null) |
| | 66 | | { |
| 80 | 67 | | writer.WritePropertyName("frontendPort"); |
| 80 | 68 | | writer.WriteNumberValue(FrontendPort.Value); |
| | 69 | | } |
| 80 | 70 | | if (BackendPort != null) |
| | 71 | | { |
| 80 | 72 | | writer.WritePropertyName("backendPort"); |
| 80 | 73 | | writer.WriteNumberValue(BackendPort.Value); |
| | 74 | | } |
| 80 | 75 | | if (IdleTimeoutInMinutes != null) |
| | 76 | | { |
| 40 | 77 | | writer.WritePropertyName("idleTimeoutInMinutes"); |
| 40 | 78 | | writer.WriteNumberValue(IdleTimeoutInMinutes.Value); |
| | 79 | | } |
| 80 | 80 | | if (EnableFloatingIP != null) |
| | 81 | | { |
| 80 | 82 | | writer.WritePropertyName("enableFloatingIP"); |
| 80 | 83 | | writer.WriteBooleanValue(EnableFloatingIP.Value); |
| | 84 | | } |
| 80 | 85 | | if (EnableTcpReset != null) |
| | 86 | | { |
| 8 | 87 | | writer.WritePropertyName("enableTcpReset"); |
| 8 | 88 | | writer.WriteBooleanValue(EnableTcpReset.Value); |
| | 89 | | } |
| 80 | 90 | | if (DisableOutboundSnat != null) |
| | 91 | | { |
| 0 | 92 | | writer.WritePropertyName("disableOutboundSnat"); |
| 0 | 93 | | writer.WriteBooleanValue(DisableOutboundSnat.Value); |
| | 94 | | } |
| 80 | 95 | | if (ProvisioningState != null) |
| | 96 | | { |
| 8 | 97 | | writer.WritePropertyName("provisioningState"); |
| 8 | 98 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 99 | | } |
| 80 | 100 | | writer.WriteEndObject(); |
| 80 | 101 | | writer.WriteEndObject(); |
| 80 | 102 | | } |
| | 103 | |
|
| | 104 | | internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement element) |
| | 105 | | { |
| 116 | 106 | | string name = default; |
| 116 | 107 | | string etag = default; |
| 116 | 108 | | string type = default; |
| 116 | 109 | | string id = default; |
| 116 | 110 | | SubResource frontendIPConfiguration = default; |
| 116 | 111 | | SubResource backendAddressPool = default; |
| 116 | 112 | | SubResource probe = default; |
| 116 | 113 | | TransportProtocol? protocol = default; |
| 116 | 114 | | LoadDistribution? loadDistribution = default; |
| 116 | 115 | | int? frontendPort = default; |
| 116 | 116 | | int? backendPort = default; |
| 116 | 117 | | int? idleTimeoutInMinutes = default; |
| 116 | 118 | | bool? enableFloatingIP = default; |
| 116 | 119 | | bool? enableTcpReset = default; |
| 116 | 120 | | bool? disableOutboundSnat = default; |
| 116 | 121 | | ProvisioningState? provisioningState = default; |
| 1392 | 122 | | foreach (var property in element.EnumerateObject()) |
| | 123 | | { |
| 580 | 124 | | if (property.NameEquals("name")) |
| | 125 | | { |
| 116 | 126 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| | 128 | | continue; |
| | 129 | | } |
| 116 | 130 | | name = property.Value.GetString(); |
| 116 | 131 | | continue; |
| | 132 | | } |
| 464 | 133 | | if (property.NameEquals("etag")) |
| | 134 | | { |
| 116 | 135 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 136 | | { |
| | 137 | | continue; |
| | 138 | | } |
| 116 | 139 | | etag = property.Value.GetString(); |
| 116 | 140 | | continue; |
| | 141 | | } |
| 348 | 142 | | if (property.NameEquals("type")) |
| | 143 | | { |
| 116 | 144 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 145 | | { |
| | 146 | | continue; |
| | 147 | | } |
| 116 | 148 | | type = property.Value.GetString(); |
| 116 | 149 | | continue; |
| | 150 | | } |
| 232 | 151 | | if (property.NameEquals("id")) |
| | 152 | | { |
| 116 | 153 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 154 | | { |
| | 155 | | continue; |
| | 156 | | } |
| 116 | 157 | | id = property.Value.GetString(); |
| 116 | 158 | | continue; |
| | 159 | | } |
| 116 | 160 | | if (property.NameEquals("properties")) |
| | 161 | | { |
| 3240 | 162 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 163 | | { |
| 1504 | 164 | | if (property0.NameEquals("frontendIPConfiguration")) |
| | 165 | | { |
| 116 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 116 | 170 | | frontendIPConfiguration = DeserializeSubResource(property0.Value); |
| 116 | 171 | | continue; |
| | 172 | | } |
| 1388 | 173 | | if (property0.NameEquals("backendAddressPool")) |
| | 174 | | { |
| 116 | 175 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 116 | 179 | | backendAddressPool = DeserializeSubResource(property0.Value); |
| 116 | 180 | | continue; |
| | 181 | | } |
| 1272 | 182 | | if (property0.NameEquals("probe")) |
| | 183 | | { |
| 112 | 184 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 112 | 188 | | probe = DeserializeSubResource(property0.Value); |
| 112 | 189 | | continue; |
| | 190 | | } |
| 1160 | 191 | | if (property0.NameEquals("protocol")) |
| | 192 | | { |
| 116 | 193 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 116 | 197 | | protocol = new TransportProtocol(property0.Value.GetString()); |
| 116 | 198 | | continue; |
| | 199 | | } |
| 1044 | 200 | | if (property0.NameEquals("loadDistribution")) |
| | 201 | | { |
| 116 | 202 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 116 | 206 | | loadDistribution = new LoadDistribution(property0.Value.GetString()); |
| 116 | 207 | | continue; |
| | 208 | | } |
| 928 | 209 | | if (property0.NameEquals("frontendPort")) |
| | 210 | | { |
| 116 | 211 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 116 | 215 | | frontendPort = property0.Value.GetInt32(); |
| 116 | 216 | | continue; |
| | 217 | | } |
| 812 | 218 | | if (property0.NameEquals("backendPort")) |
| | 219 | | { |
| 116 | 220 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 221 | | { |
| | 222 | | continue; |
| | 223 | | } |
| 116 | 224 | | backendPort = property0.Value.GetInt32(); |
| 116 | 225 | | continue; |
| | 226 | | } |
| 696 | 227 | | if (property0.NameEquals("idleTimeoutInMinutes")) |
| | 228 | | { |
| 116 | 229 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 230 | | { |
| | 231 | | continue; |
| | 232 | | } |
| 116 | 233 | | idleTimeoutInMinutes = property0.Value.GetInt32(); |
| 116 | 234 | | continue; |
| | 235 | | } |
| 580 | 236 | | if (property0.NameEquals("enableFloatingIP")) |
| | 237 | | { |
| 116 | 238 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 239 | | { |
| | 240 | | continue; |
| | 241 | | } |
| 116 | 242 | | enableFloatingIP = property0.Value.GetBoolean(); |
| 116 | 243 | | continue; |
| | 244 | | } |
| 464 | 245 | | if (property0.NameEquals("enableTcpReset")) |
| | 246 | | { |
| 116 | 247 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 248 | | { |
| | 249 | | continue; |
| | 250 | | } |
| 116 | 251 | | enableTcpReset = property0.Value.GetBoolean(); |
| 116 | 252 | | continue; |
| | 253 | | } |
| 348 | 254 | | if (property0.NameEquals("disableOutboundSnat")) |
| | 255 | | { |
| 0 | 256 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 257 | | { |
| | 258 | | continue; |
| | 259 | | } |
| 0 | 260 | | disableOutboundSnat = property0.Value.GetBoolean(); |
| 0 | 261 | | continue; |
| | 262 | | } |
| 348 | 263 | | if (property0.NameEquals("provisioningState")) |
| | 264 | | { |
| 116 | 265 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 266 | | { |
| | 267 | | continue; |
| | 268 | | } |
| 116 | 269 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 270 | | continue; |
| | 271 | | } |
| | 272 | | } |
| | 273 | | continue; |
| | 274 | | } |
| | 275 | | } |
| 116 | 276 | | return new LoadBalancingRule(id, name, etag, type, frontendIPConfiguration, backendAddressPool, probe, proto |
| | 277 | | } |
| | 278 | | } |
| | 279 | | } |