internal static AppServiceEnvironmentUpdateOptions DeserializeAppServiceEnvironmentUpdateOptions(JsonElement element)
        {
            Optional <string>                   kind                      = default;
            ResourceIdentifier                  id                        = default;
            string                              name                      = default;
            ResourceType                        type                      = default;
            SystemData                          systemData                = default;
            Optional <ProvisioningState>        provisioningState         = default;
            Optional <HostingEnvironmentStatus> status                    = default;
            Optional <VirtualNetworkProfile>    virtualNetwork            = default;
            Optional <LoadBalancingMode>        internalLoadBalancingMode = default;
            Optional <string>                   multiSize                 = default;
            Optional <int>                      multiRoleCount            = default;
            Optional <int>                      ipsslAddressCount         = default;
            Optional <string>                   dnsSuffix                 = default;
            Optional <int>                      maximumNumberOfMachines   = default;
            Optional <int>                      frontEndScaleFactor       = default;
            Optional <bool>                     suspended                 = default;
            Optional <IList <NameValuePair> >   clusterSettings           = default;
            Optional <IList <string> >          userWhitelistedIpRanges   = default;
            Optional <bool>                     hasLinuxWorkers           = default;
            Optional <int>                      dedicatedHostCount        = default;
            Optional <bool>                     zoneRedundant             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(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("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            status = property0.Value.GetString().ToHostingEnvironmentStatus();
                            continue;
                        }
                        if (property0.NameEquals("virtualNetwork"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualNetwork = VirtualNetworkProfile.DeserializeVirtualNetworkProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("internalLoadBalancingMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            internalLoadBalancingMode = new LoadBalancingMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("multiSize"))
                        {
                            multiSize = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("multiRoleCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            multiRoleCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("ipsslAddressCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            ipsslAddressCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("dnsSuffix"))
                        {
                            dnsSuffix = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("maximumNumberOfMachines"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maximumNumberOfMachines = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("frontEndScaleFactor"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            frontEndScaleFactor = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("suspended"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            suspended = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("clusterSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NameValuePair> array = new List <NameValuePair>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NameValuePair.DeserializeNameValuePair(item));
                            }
                            clusterSettings = array;
                            continue;
                        }
                        if (property0.NameEquals("userWhitelistedIpRanges"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            userWhitelistedIpRanges = array;
                            continue;
                        }
                        if (property0.NameEquals("hasLinuxWorkers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hasLinuxWorkers = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("dedicatedHostCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dedicatedHostCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("zoneRedundant"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            zoneRedundant = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AppServiceEnvironmentUpdateOptions(id, name, type, systemData, kind.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), virtualNetwork.Value, Optional.ToNullable(internalLoadBalancingMode), multiSize.Value, Optional.ToNullable(multiRoleCount), Optional.ToNullable(ipsslAddressCount), dnsSuffix.Value, Optional.ToNullable(maximumNumberOfMachines), Optional.ToNullable(frontEndScaleFactor), Optional.ToNullable(suspended), Optional.ToList(clusterSettings), Optional.ToList(userWhitelistedIpRanges), Optional.ToNullable(hasLinuxWorkers), Optional.ToNullable(dedicatedHostCount), Optional.ToNullable(zoneRedundant)));
        }
Пример #2
0
        internal static Solution DeserializeSolution(JsonElement element)
        {
            Optional <double>       id                          = default;
            Optional <string>       displayName                 = default;
            Optional <double>       order                       = default;
            Optional <string>       description                 = default;
            Optional <SolutionType> type                        = default;
            Optional <IList <IList <NameValuePair> > > data     = default;
            Optional <IList <IList <NameValuePair> > > metadata = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("order"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    order = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = property.Value.GetString().ToSolutionType();
                    continue;
                }
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <IList <NameValuePair> > array = new List <IList <NameValuePair> >();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        List <NameValuePair> array0 = new List <NameValuePair>();
                        foreach (var item0 in item.EnumerateArray())
                        {
                            array0.Add(NameValuePair.DeserializeNameValuePair(item0));
                        }
                        array.Add(array0);
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("metadata"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <IList <NameValuePair> > array = new List <IList <NameValuePair> >();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        List <NameValuePair> array0 = new List <NameValuePair>();
                        foreach (var item0 in item.EnumerateArray())
                        {
                            array0.Add(NameValuePair.DeserializeNameValuePair(item0));
                        }
                        array.Add(array0);
                    }
                    metadata = array;
                    continue;
                }
            }
            return(new Solution(Optional.ToNullable(id), displayName.Value, Optional.ToNullable(order), description.Value, Optional.ToNullable(type), Optional.ToList(data), Optional.ToList(metadata)));
        }
Пример #3
0
        internal static AnalysisData DeserializeAnalysisData(JsonElement element)
        {
            Optional <string>                          source             = default;
            Optional <DetectorDefinition>              detectorDefinition = default;
            Optional <IList <DiagnosticMetricSet> >    metrics            = default;
            Optional <IList <IList <NameValuePair> > > data             = default;
            Optional <ResponseMetaData>                detectorMetaData = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("source"))
                {
                    source = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("detectorDefinition"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    detectorDefinition = DetectorDefinition.DeserializeDetectorDefinition(property.Value);
                    continue;
                }
                if (property.NameEquals("metrics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <DiagnosticMetricSet> array = new List <DiagnosticMetricSet>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DiagnosticMetricSet.DeserializeDiagnosticMetricSet(item));
                    }
                    metrics = array;
                    continue;
                }
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <IList <NameValuePair> > array = new List <IList <NameValuePair> >();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        List <NameValuePair> array0 = new List <NameValuePair>();
                        foreach (var item0 in item.EnumerateArray())
                        {
                            array0.Add(NameValuePair.DeserializeNameValuePair(item0));
                        }
                        array.Add(array0);
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("detectorMetaData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    detectorMetaData = ResponseMetaData.DeserializeResponseMetaData(property.Value);
                    continue;
                }
            }
            return(new AnalysisData(source.Value, detectorDefinition.Value, Optional.ToList(metrics), Optional.ToList(data), detectorMetaData.Value));
        }