示例#1
0
        internal static LoadBalancerConfiguration DeserializeLoadBalancerConfiguration(JsonElement element)
        {
            Optional <ResourceIdentifier> id = default;
            string name = default;
            IList <LoadBalancerFrontendIPConfiguration> frontendIpConfigurations = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("frontendIpConfigurations"))
                        {
                            List <LoadBalancerFrontendIPConfiguration> array = new List <LoadBalancerFrontendIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(LoadBalancerFrontendIPConfiguration.DeserializeLoadBalancerFrontendIPConfiguration(item));
                            }
                            frontendIpConfigurations = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new LoadBalancerConfiguration(id.Value, name, frontendIpConfigurations));
        }
        internal static LoadBalancerConfigurationProperties DeserializeLoadBalancerConfigurationProperties(JsonElement element)
        {
            IList <LoadBalancerFrontendIPConfiguration> frontendIPConfigurations = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("frontendIPConfigurations"))
                {
                    List <LoadBalancerFrontendIPConfiguration> array = new List <LoadBalancerFrontendIPConfiguration>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(LoadBalancerFrontendIPConfiguration.DeserializeLoadBalancerFrontendIPConfiguration(item));
                    }
                    frontendIPConfigurations = array;
                    continue;
                }
            }
            return(new LoadBalancerConfigurationProperties(frontendIPConfigurations));
        }