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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } action = FirewallPolicyFilterRuleAction.DeserializeFirewallPolicyFilterRuleAction(property.Value); continue; } if (property.NameEquals("ruleConditions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyFilterRule(ruleType, name.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(ruleConditions))); }
internal FirewallPolicyFilterRule(FirewallPolicyRuleType ruleType, string name, int?priority, FirewallPolicyFilterRuleAction action, IList <FirewallPolicyRuleCondition> ruleConditions) : base(ruleType, name, priority) { Action = action; RuleConditions = ruleConditions; RuleType = ruleType; }
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)); }