internal static BgpSettings DeserializeBgpSettings(JsonElement element) { long? asn = default; string bgpPeeringAddress = default; int? peerWeight = default; IList <IPConfigurationBgpPeeringAddress> bgpPeeringAddresses = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("asn")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } asn = property.Value.GetInt64(); continue; } if (property.NameEquals("bgpPeeringAddress")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } bgpPeeringAddress = property.Value.GetString(); continue; } if (property.NameEquals("peerWeight")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } peerWeight = property.Value.GetInt32(); continue; } if (property.NameEquals("bgpPeeringAddresses")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <IPConfigurationBgpPeeringAddress> array = new List <IPConfigurationBgpPeeringAddress>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(IPConfigurationBgpPeeringAddress.DeserializeIPConfigurationBgpPeeringAddress(item)); } } bgpPeeringAddresses = array; continue; } } return(new BgpSettings(asn, bgpPeeringAddress, peerWeight, bgpPeeringAddresses)); }
internal static BgpSettings DeserializeBgpSettings(JsonElement element) { Optional <long> asn = default; Optional <string> bgpPeeringAddress = default; Optional <int> peerWeight = default; Optional <IList <IPConfigurationBgpPeeringAddress> > bgpPeeringAddresses = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("asn")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } asn = property.Value.GetInt64(); continue; } if (property.NameEquals("bgpPeeringAddress")) { bgpPeeringAddress = property.Value.GetString(); continue; } if (property.NameEquals("peerWeight")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } peerWeight = property.Value.GetInt32(); continue; } if (property.NameEquals("bgpPeeringAddresses")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <IPConfigurationBgpPeeringAddress> array = new List <IPConfigurationBgpPeeringAddress>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(IPConfigurationBgpPeeringAddress.DeserializeIPConfigurationBgpPeeringAddress(item)); } bgpPeeringAddresses = array; continue; } } return(new BgpSettings(Optional.ToNullable(asn), bgpPeeringAddress.Value, Optional.ToNullable(peerWeight), Optional.ToList(bgpPeeringAddresses))); }