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