Пример #1
0
        internal static ExpressRoutePortsLocation DeserializeExpressRoutePortsLocation(JsonElement element)
        {
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string> tags = default;
            string address = default;
            string contact = default;
            IList <ExpressRoutePortsLocationBandwidths> availableBandwidths = default;
            ProvisioningState?provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                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("address"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            address = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("contact"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            contact = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("availableBandwidths"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <ExpressRoutePortsLocationBandwidths> array = new List <ExpressRoutePortsLocationBandwidths>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(ExpressRoutePortsLocationBandwidths.DeserializeExpressRoutePortsLocationBandwidths(item));
                                }
                            }
                            availableBandwidths = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRoutePortsLocation(id, name, type, location, tags, address, contact, availableBandwidths, provisioningState));
        }
Пример #2
0
        internal static ExpressRoutePortsLocation DeserializeExpressRoutePortsLocation(JsonElement element)
        {
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            Optional <string> location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string> address = default;
            Optional <string> contact = default;
            Optional <IList <ExpressRoutePortsLocationBandwidths> > availableBandwidths = default;
            Optional <ProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = 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("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("address"))
                        {
                            address = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("contact"))
                        {
                            contact = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("availableBandwidths"))
                        {
                            List <ExpressRoutePortsLocationBandwidths> array = new List <ExpressRoutePortsLocationBandwidths>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ExpressRoutePortsLocationBandwidths.DeserializeExpressRoutePortsLocationBandwidths(item));
                            }
                            availableBandwidths = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRoutePortsLocation(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), address.Value, contact.Value, Optional.ToList(availableBandwidths), Optional.ToNullable(provisioningState)));
        }