internal ApplicationGatewayRewriteRule(string name, int?ruleSequence, IList <ApplicationGatewayRewriteRuleCondition> conditions, ApplicationGatewayRewriteRuleActionSet actionSet)
 {
     Name         = name;
     RuleSequence = ruleSequence;
     Conditions   = conditions;
     ActionSet    = actionSet;
 }
Пример #2
0
        internal static ApplicationGatewayRewriteRule DeserializeApplicationGatewayRewriteRule(JsonElement element)
        {
            string name         = default;
            int?   ruleSequence = default;
            IList <ApplicationGatewayRewriteRuleCondition> conditions = default;
            ApplicationGatewayRewriteRuleActionSet         actionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("ruleSequence"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    ruleSequence = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("conditions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ApplicationGatewayRewriteRuleCondition> array = new List <ApplicationGatewayRewriteRuleCondition>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(ApplicationGatewayRewriteRuleCondition.DeserializeApplicationGatewayRewriteRuleCondition(item));
                        }
                    }
                    conditions = array;
                    continue;
                }
                if (property.NameEquals("actionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    actionSet = ApplicationGatewayRewriteRuleActionSet.DeserializeApplicationGatewayRewriteRuleActionSet(property.Value);
                    continue;
                }
            }
            return(new ApplicationGatewayRewriteRule(name, ruleSequence, conditions, actionSet));
        }
Пример #3
0
        internal static ApplicationGatewayRewriteRule DeserializeApplicationGatewayRewriteRule(JsonElement element)
        {
            Optional <string> name         = default;
            Optional <int>    ruleSequence = default;
            Optional <IList <ApplicationGatewayRewriteRuleCondition> > conditions = default;
            Optional <ApplicationGatewayRewriteRuleActionSet>          actionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("ruleSequence"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    ruleSequence = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("conditions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ApplicationGatewayRewriteRuleCondition> array = new List <ApplicationGatewayRewriteRuleCondition>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ApplicationGatewayRewriteRuleCondition.DeserializeApplicationGatewayRewriteRuleCondition(item));
                    }
                    conditions = array;
                    continue;
                }
                if (property.NameEquals("actionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    actionSet = ApplicationGatewayRewriteRuleActionSet.DeserializeApplicationGatewayRewriteRuleActionSet(property.Value);
                    continue;
                }
            }
            return(new ApplicationGatewayRewriteRule(name.Value, Optional.ToNullable(ruleSequence), Optional.ToList(conditions), actionSet.Value));
        }