Esempio n. 1
0
        internal static PerformanceLevelCapability DeserializePerformanceLevelCapability(JsonElement element)
        {
            Optional <double> value = default;
            Optional <PerformanceLevelUnit> unit = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    value = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("unit"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    unit = new PerformanceLevelUnit(property.Value.GetString());
                    continue;
                }
            }
            return(new PerformanceLevelCapability(Optional.ToNullable(value), Optional.ToNullable(unit)));
        }
        internal static ElasticPoolPerDatabaseMinPerformanceLevelCapability DeserializeElasticPoolPerDatabaseMinPerformanceLevelCapability(JsonElement element)
        {
            Optional <double> limit = default;
            Optional <PerformanceLevelUnit> unit   = default;
            Optional <CapabilityStatus>     status = default;
            Optional <string> reason = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("limit"))
                {
                    limit = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("unit"))
                {
                    unit = new PerformanceLevelUnit(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToCapabilityStatus();
                    continue;
                }
                if (property.NameEquals("reason"))
                {
                    reason = property.Value.GetString();
                    continue;
                }
            }
            return(new ElasticPoolPerDatabaseMinPerformanceLevelCapability(Optional.ToNullable(limit), Optional.ToNullable(unit), Optional.ToNullable(status), reason.Value));
        }
Esempio n. 3
0
        internal static ElasticPoolPerDatabaseMaxPerformanceLevelCapability DeserializeElasticPoolPerDatabaseMaxPerformanceLevelCapability(JsonElement element)
        {
            Optional <double> limit = default;
            Optional <PerformanceLevelUnit> unit = default;
            Optional <IReadOnlyList <ElasticPoolPerDatabaseMinPerformanceLevelCapability> > supportedPerDatabaseMinPerformanceLevels = default;
            Optional <CapabilityStatus> status = default;
            Optional <string>           reason = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("limit"))
                {
                    limit = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("unit"))
                {
                    unit = new PerformanceLevelUnit(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("supportedPerDatabaseMinPerformanceLevels"))
                {
                    List <ElasticPoolPerDatabaseMinPerformanceLevelCapability> array = new List <ElasticPoolPerDatabaseMinPerformanceLevelCapability>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ElasticPoolPerDatabaseMinPerformanceLevelCapability.DeserializeElasticPoolPerDatabaseMinPerformanceLevelCapability(item));
                    }
                    supportedPerDatabaseMinPerformanceLevels = array;
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToCapabilityStatus();
                    continue;
                }
                if (property.NameEquals("reason"))
                {
                    reason = property.Value.GetString();
                    continue;
                }
            }
            return(new ElasticPoolPerDatabaseMaxPerformanceLevelCapability(Optional.ToNullable(limit), Optional.ToNullable(unit), Optional.ToList(supportedPerDatabaseMinPerformanceLevels), Optional.ToNullable(status), reason.Value));
        }