Beispiel #1
0
        internal static DeliveryRuleCondition DeserializeDeliveryRuleCondition(JsonElement element)
        {
            if (element.TryGetProperty("name", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "ClientPort": return(DeliveryRuleClientPortCondition.DeserializeDeliveryRuleClientPortCondition(element));

                case "Cookies": return(DeliveryRuleCookiesCondition.DeserializeDeliveryRuleCookiesCondition(element));

                case "HostName": return(DeliveryRuleHostNameCondition.DeserializeDeliveryRuleHostNameCondition(element));

                case "HttpVersion": return(DeliveryRuleHttpVersionCondition.DeserializeDeliveryRuleHttpVersionCondition(element));

                case "IsDevice": return(DeliveryRuleIsDeviceCondition.DeserializeDeliveryRuleIsDeviceCondition(element));

                case "PostArgs": return(DeliveryRulePostArgsCondition.DeserializeDeliveryRulePostArgsCondition(element));

                case "QueryString": return(DeliveryRuleQueryStringCondition.DeserializeDeliveryRuleQueryStringCondition(element));

                case "RemoteAddress": return(DeliveryRuleRemoteAddressCondition.DeserializeDeliveryRuleRemoteAddressCondition(element));

                case "RequestBody": return(DeliveryRuleRequestBodyCondition.DeserializeDeliveryRuleRequestBodyCondition(element));

                case "RequestHeader": return(DeliveryRuleRequestHeaderCondition.DeserializeDeliveryRuleRequestHeaderCondition(element));

                case "RequestMethod": return(DeliveryRuleRequestMethodCondition.DeserializeDeliveryRuleRequestMethodCondition(element));

                case "RequestScheme": return(DeliveryRuleRequestSchemeCondition.DeserializeDeliveryRuleRequestSchemeCondition(element));

                case "RequestUri": return(DeliveryRuleRequestUriCondition.DeserializeDeliveryRuleRequestUriCondition(element));

                case "ServerPort": return(DeliveryRuleServerPortCondition.DeserializeDeliveryRuleServerPortCondition(element));

                case "SocketAddr": return(DeliveryRuleSocketAddressCondition.DeserializeDeliveryRuleSocketAddressCondition(element));

                case "SslProtocol": return(DeliveryRuleSslProtocolCondition.DeserializeDeliveryRuleSslProtocolCondition(element));

                case "UrlFileExtension": return(DeliveryRuleUriFileExtensionCondition.DeserializeDeliveryRuleUriFileExtensionCondition(element));

                case "UrlFileName": return(DeliveryRuleUriFileNameCondition.DeserializeDeliveryRuleUriFileNameCondition(element));

                case "UrlPath": return(DeliveryRuleUriPathCondition.DeserializeDeliveryRuleUriPathCondition(element));
                }
            }
            MatchVariable name = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new MatchVariable(property.Value.GetString());
                    continue;
                }
            }
            return(new DeliveryRuleCondition(name));
        }
Beispiel #2
0
 internal MatchCondition(MatchVariable matchVariable, string selector, MatchOperator @operator, bool?negateCondition, IList <string> matchValue, IList <TransformType> transforms)
 {
     MatchVariable   = matchVariable;
     Selector        = selector;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValue      = matchValue;
     Transforms      = transforms;
 }
Beispiel #3
0
        public MatchCondition(MatchVariable matchVariable, MatchOperator @operator, IEnumerable <string> matchValue)
        {
            if (matchValue == null)
            {
                throw new ArgumentNullException(nameof(matchValue));
            }

            MatchVariable = matchVariable;
            Operator      = @operator;
            MatchValue    = matchValue.ToList();
            Transforms    = new ChangeTrackingList <TransformType>();
        }
Beispiel #4
0
        internal static DeliveryRuleServerPortCondition DeserializeDeliveryRuleServerPortCondition(JsonElement element)
        {
            ServerPortMatchCondition parameters = default;
            MatchVariable            name       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("parameters"))
                {
                    parameters = ServerPortMatchCondition.DeserializeServerPortMatchCondition(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = new MatchVariable(property.Value.GetString());
                    continue;
                }
            }
            return(new DeliveryRuleServerPortCondition(name, parameters));
        }
Beispiel #5
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("matchVariable");
     writer.WriteStringValue(MatchVariable.ToString());
     if (Optional.IsDefined(Selector))
     {
         writer.WritePropertyName("selector");
         writer.WriteStringValue(Selector);
     }
     writer.WritePropertyName("operator");
     writer.WriteStringValue(Operator.ToString());
     if (Optional.IsDefined(NegateCondition))
     {
         writer.WritePropertyName("negateCondition");
         writer.WriteBooleanValue(NegateCondition.Value);
     }
     writer.WritePropertyName("matchValue");
     writer.WriteStartArray();
     foreach (var item in MatchValue)
     {
         writer.WriteStringValue(item);
     }
     writer.WriteEndArray();
     if (Optional.IsCollectionDefined(Transforms))
     {
         writer.WritePropertyName("transforms");
         writer.WriteStartArray();
         foreach (var item in Transforms)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
 internal DeliveryRuleRequestUriCondition(MatchVariable name, RequestUriMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #7
0
 internal DeliveryRuleRequestHeaderCondition(MatchVariable name, RequestHeaderMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
Beispiel #8
0
 internal DeliveryRuleCookiesCondition(MatchVariable name, CookiesMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
 internal DeliveryRulePostArgsCondition(MatchVariable name, PostArgsMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #10
0
 internal DeliveryRuleUriPathCondition(MatchVariable name, UriPathMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
 internal DeliveryRuleUrlFileExtensionCondition(MatchVariable name, UrlFileExtensionMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
 internal DeliveryRuleRequestSchemeCondition(MatchVariable name, RequestSchemeMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #13
0
 internal DeliveryRuleClientPortCondition(MatchVariable name, ClientPortMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
Beispiel #14
0
 internal DeliveryRuleIsDeviceCondition(MatchVariable name, IsDeviceMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
 internal DeliveryRuleHttpVersionCondition(MatchVariable name, HttpVersionMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #16
0
 internal DeliveryRuleHttpVersionCondition(MatchVariable name, HttpVersionMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
Beispiel #17
0
 internal DeliveryRuleSslProtocolCondition(MatchVariable name, SslProtocolMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #18
0
 internal DeliveryRulePostArgsCondition(MatchVariable name, PostArgsMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
Beispiel #19
0
        internal static MatchCondition DeserializeMatchCondition(JsonElement element)
        {
            MatchVariable     matchVariable              = default;
            Optional <string> selector                   = default;
            MatchOperator     @operator                  = default;
            Optional <bool>   negateCondition            = default;
            IList <string>    matchValue                 = default;
            Optional <IList <TransformType> > transforms = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("matchVariable"))
                {
                    matchVariable = new MatchVariable(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("selector"))
                {
                    selector = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new MatchOperator(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("negateCondition"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    negateCondition = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("matchValue"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    matchValue = array;
                    continue;
                }
                if (property.NameEquals("transforms"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TransformType> array = new List <TransformType>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new TransformType(item.GetString()));
                    }
                    transforms = array;
                    continue;
                }
            }
            return(new MatchCondition(matchVariable, selector.Value, @operator, Optional.ToNullable(negateCondition), matchValue, Optional.ToList(transforms)));
        }
 internal DeliveryRuleServerPortCondition(MatchVariable name, ServerPortMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #21
0
 internal DeliveryRuleUrlPathCondition(MatchVariable name, UrlPathMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
 internal DeliveryRuleUriFileNameCondition(MatchVariable name, UriFileNameMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
 internal DeliveryRuleSocketAddrCondition(MatchVariable name, SocketAddrMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
 internal DeliveryRuleIsDeviceCondition(MatchVariable name, IsDeviceMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #25
0
 internal DeliveryRuleRemoteAddressCondition(MatchVariable name, RemoteAddressMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
Beispiel #26
0
 internal DeliveryRuleRemoteAddressCondition(MatchVariable name, RemoteAddressMatchConditionParameters parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
 internal DeliveryRuleCookiesCondition(MatchVariable name, CookiesMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
Beispiel #28
0
 internal DeliveryRuleSslProtocolCondition(MatchVariable name, SslProtocolMatchCondition properties) : base(name)
 {
     Properties = properties;
     Name       = name;
 }
 internal DeliveryRuleClientPortCondition(MatchVariable name, ClientPortMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }
 internal DeliveryRuleQueryStringCondition(MatchVariable name, QueryStringMatchConditionDefinition parameters) : base(name)
 {
     Parameters = parameters;
     Name       = name;
 }