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