internal static VirtualHubRouteTableV2 DeserializeVirtualHubRouteTableV2(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> etag = default;
            Optional <string> id   = default;
            Optional <IList <VirtualHubRouteV2> > routes = default;
            Optional <IList <string> >            attachedConnections = 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("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("routes"))
                        {
                            List <VirtualHubRouteV2> array = new List <VirtualHubRouteV2>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualHubRouteV2.DeserializeVirtualHubRouteV2(item));
                            }
                            routes = array;
                            continue;
                        }
                        if (property0.NameEquals("attachedConnections"))
                        {
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            attachedConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualHubRouteTableV2(id.Value, name.Value, etag.Value, Optional.ToList(routes), Optional.ToList(attachedConnections), Optional.ToNullable(provisioningState)));
        }
예제 #2
0
        internal static VirtualHubRouteTableV2 DeserializeVirtualHubRouteTableV2(JsonElement element)
        {
            string name = default;
            string etag = default;
            string id   = default;
            IList <VirtualHubRouteV2> routes = default;
            IList <string>            attachedConnections = default;
            ProvisioningState?        provisioningState   = 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("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("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("routes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <VirtualHubRouteV2> array = new List <VirtualHubRouteV2>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(VirtualHubRouteV2.DeserializeVirtualHubRouteV2(item));
                                }
                            }
                            routes = array;
                            continue;
                        }
                        if (property0.NameEquals("attachedConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(item.GetString());
                                }
                            }
                            attachedConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualHubRouteTableV2(id, name, etag, routes, attachedConnections, provisioningState));
        }