internal static FirewallPolicyNatRule DeserializeFirewallPolicyNatRule(JsonElement element) { Optional <FirewallPolicyNatRuleAction> action = default; Optional <string> translatedAddress = default; Optional <string> translatedPort = default; Optional <FirewallPolicyRuleCondition> ruleCondition = default; FirewallPolicyRuleType ruleType = default; Optional <string> name = default; Optional <int> priority = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action")) { action = FirewallPolicyNatRuleAction.DeserializeFirewallPolicyNatRuleAction(property.Value); continue; } if (property.NameEquals("translatedAddress")) { translatedAddress = property.Value.GetString(); continue; } if (property.NameEquals("translatedPort")) { translatedPort = property.Value.GetString(); continue; } if (property.NameEquals("ruleCondition")) { ruleCondition = FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(property.Value); continue; } if (property.NameEquals("ruleType")) { ruleType = new FirewallPolicyRuleType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyNatRule(ruleType, name.Value, Optional.ToNullable(priority), action.Value, translatedAddress.Value, translatedPort.Value, ruleCondition.Value)); }
internal static FirewallPolicyFilterRule DeserializeFirewallPolicyFilterRule(JsonElement element) { Optional <FirewallPolicyFilterRuleAction> action = default; Optional <IList <FirewallPolicyRuleCondition> > ruleConditions = default; FirewallPolicyRuleType ruleType = default; Optional <string> name = default; Optional <int> priority = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action")) { action = FirewallPolicyFilterRuleAction.DeserializeFirewallPolicyFilterRuleAction(property.Value); continue; } if (property.NameEquals("ruleConditions")) { List <FirewallPolicyRuleCondition> array = new List <FirewallPolicyRuleCondition>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(item)); } ruleConditions = array; continue; } if (property.NameEquals("ruleType")) { ruleType = new FirewallPolicyRuleType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyFilterRule(ruleType, name.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(ruleConditions))); }
internal static FirewallPolicyFilterRule DeserializeFirewallPolicyFilterRule(JsonElement element) { FirewallPolicyFilterRuleAction action = default; IList <FirewallPolicyRuleCondition> ruleConditions = default; FirewallPolicyRuleType ruleType = default; string name = default; int? priority = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } action = FirewallPolicyFilterRuleAction.DeserializeFirewallPolicyFilterRuleAction(property.Value); continue; } if (property.NameEquals("ruleConditions")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <FirewallPolicyRuleCondition> array = new List <FirewallPolicyRuleCondition>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(item)); } } ruleConditions = array; continue; } if (property.NameEquals("ruleType")) { ruleType = new FirewallPolicyRuleType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyFilterRule(ruleType, name, priority, action, ruleConditions)); }
internal static FirewallPolicyNatRule DeserializeFirewallPolicyNatRule(JsonElement element) { FirewallPolicyNatRuleAction action = default; string translatedAddress = default; string translatedPort = default; FirewallPolicyRuleCondition ruleCondition = default; FirewallPolicyRuleType ruleType = default; string name = default; int? priority = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } action = FirewallPolicyNatRuleAction.DeserializeFirewallPolicyNatRuleAction(property.Value); continue; } if (property.NameEquals("translatedAddress")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } translatedAddress = property.Value.GetString(); continue; } if (property.NameEquals("translatedPort")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } translatedPort = property.Value.GetString(); continue; } if (property.NameEquals("ruleCondition")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } ruleCondition = FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(property.Value); continue; } if (property.NameEquals("ruleType")) { ruleType = new FirewallPolicyRuleType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyNatRule(ruleType, name, priority, action, translatedAddress, translatedPort, ruleCondition)); }