internal WebApplicationFirewallCustomRule(string name, string etag, int priority, WebApplicationFirewallRuleType ruleType, IList <MatchCondition> matchConditions, WebApplicationFirewallAction action) { Name = name; Etag = etag; Priority = priority; RuleType = ruleType; MatchConditions = matchConditions; Action = action; }
public WebApplicationFirewallCustomRule(int priority, WebApplicationFirewallRuleType ruleType, IEnumerable <MatchCondition> matchConditions, WebApplicationFirewallAction action) { if (matchConditions == null) { throw new ArgumentNullException(nameof(matchConditions)); } Priority = priority; RuleType = ruleType; MatchConditions = matchConditions.ToArray(); Action = action; }
internal static WebApplicationFirewallCustomRule DeserializeWebApplicationFirewallCustomRule(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; int priority = default; WebApplicationFirewallRuleType ruleType = default; IList <MatchCondition> matchConditions = default; WebApplicationFirewallAction action = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { priority = property.Value.GetInt32(); continue; } if (property.NameEquals("ruleType")) { ruleType = new WebApplicationFirewallRuleType(property.Value.GetString()); continue; } if (property.NameEquals("matchConditions")) { List <MatchCondition> array = new List <MatchCondition>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(MatchCondition.DeserializeMatchCondition(item)); } matchConditions = array; continue; } if (property.NameEquals("action")) { action = new WebApplicationFirewallAction(property.Value.GetString()); continue; } } return(new WebApplicationFirewallCustomRule(name.Value, etag.Value, priority, ruleType, matchConditions, action)); }