internal static RouteFilterRuleListResult DeserializeRouteFilterRuleListResult(JsonElement element)
        {
            Optional <IReadOnlyList <RouteFilterRule> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List <RouteFilterRule> array = new List <RouteFilterRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(RouteFilterRule.DeserializeRouteFilterRule(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new RouteFilterRuleListResult(Optional.ToList(value), nextLink.Value));
        }
        internal static RouteFilterRuleListResult DeserializeRouteFilterRuleListResult(JsonElement element)
        {
            IReadOnlyList <RouteFilterRule> value = default;
            string nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <RouteFilterRule> array = new List <RouteFilterRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(RouteFilterRule.DeserializeRouteFilterRule(item));
                        }
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new RouteFilterRuleListResult(value, nextLink));
        }
Beispiel #3
0
        internal static PatchRouteFilter DeserializePatchRouteFilter(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> etag = default;
            Optional <string> type = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string> id = default;
            Optional <IList <RouteFilterRule> > rules = default;
            Optional <IReadOnlyList <ExpressRouteCircuitPeering> > peerings     = default;
            Optional <IReadOnlyList <ExpressRouteCircuitPeering> > ipv6Peerings = default;
            Optional <ProvisioningState> provisioningState = 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("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("rules"))
                        {
                            List <RouteFilterRule> array = new List <RouteFilterRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(RouteFilterRule.DeserializeRouteFilterRule(item));
                            }
                            rules = array;
                            continue;
                        }
                        if (property0.NameEquals("peerings"))
                        {
                            List <ExpressRouteCircuitPeering> array = new List <ExpressRouteCircuitPeering>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ExpressRouteCircuitPeering.DeserializeExpressRouteCircuitPeering(item));
                            }
                            peerings = array;
                            continue;
                        }
                        if (property0.NameEquals("ipv6Peerings"))
                        {
                            List <ExpressRouteCircuitPeering> array = new List <ExpressRouteCircuitPeering>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ExpressRouteCircuitPeering.DeserializeExpressRouteCircuitPeering(item));
                            }
                            ipv6Peerings = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PatchRouteFilter(id.Value, name.Value, etag.Value, type.Value, Optional.ToDictionary(tags), Optional.ToList(rules), Optional.ToList(peerings), Optional.ToList(ipv6Peerings), Optional.ToNullable(provisioningState)));
        }
        internal static RouteFilter DeserializeRouteFilter(JsonElement element)
        {
            string etag     = default;
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string>       tags         = default;
            IList <RouteFilterRule>            rules        = default;
            IList <ExpressRouteCircuitPeering> peerings     = default;
            IList <ExpressRouteCircuitPeering> ipv6Peerings = default;
            ProvisioningState?provisioningState             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("rules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <RouteFilterRule> array = new List <RouteFilterRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(RouteFilterRule.DeserializeRouteFilterRule(item));
                                }
                            }
                            rules = array;
                            continue;
                        }
                        if (property0.NameEquals("peerings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ExpressRouteCircuitPeering> array = new List <ExpressRouteCircuitPeering>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ExpressRouteCircuitPeering.DeserializeExpressRouteCircuitPeering(item));
                                }
                            }
                            peerings = array;
                            continue;
                        }
                        if (property0.NameEquals("ipv6Peerings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ExpressRouteCircuitPeering> array = new List <ExpressRouteCircuitPeering>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ExpressRouteCircuitPeering.DeserializeExpressRouteCircuitPeering(item));
                                }
                            }
                            ipv6Peerings = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RouteFilter(id, name, type, location, tags, etag, rules, peerings, ipv6Peerings, provisioningState));
        }