Exemplo n.º 1
0
        internal static ThroughputSettingsResource DeserializeThroughputSettingsResource(JsonElement element)
        {
            Optional <int> throughput = default;
            Optional <AutoscaleSettingsResource> autoscaleSettings = default;
            Optional <string> minimumThroughput   = default;
            Optional <string> offerReplacePending = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("throughput"))
                {
                    throughput = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("autoscaleSettings"))
                {
                    autoscaleSettings = AutoscaleSettingsResource.DeserializeAutoscaleSettingsResource(property.Value);
                    continue;
                }
                if (property.NameEquals("minimumThroughput"))
                {
                    minimumThroughput = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("offerReplacePending"))
                {
                    offerReplacePending = property.Value.GetString();
                    continue;
                }
            }
            return(new ThroughputSettingsResource(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value));
        }
        internal static ThroughputSettingsGetPropertiesResource DeserializeThroughputSettingsGetPropertiesResource(JsonElement element)
        {
            Optional <string> Rid        = default;
            Optional <object> Ts         = default;
            Optional <string> Etag       = default;
            Optional <int>    throughput = default;
            Optional <AutoscaleSettingsResource> autoscaleSettings = default;
            Optional <string> minimumThroughput   = default;
            Optional <string> offerReplacePending = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("_rid"))
                {
                    Rid = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("_ts"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Ts = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("_etag"))
                {
                    Etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("throughput"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    throughput = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("autoscaleSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    autoscaleSettings = AutoscaleSettingsResource.DeserializeAutoscaleSettingsResource(property.Value);
                    continue;
                }
                if (property.NameEquals("minimumThroughput"))
                {
                    minimumThroughput = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("offerReplacePending"))
                {
                    offerReplacePending = property.Value.GetString();
                    continue;
                }
            }
            return(new ThroughputSettingsGetPropertiesResource(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, Rid.Value, Ts.Value, Etag.Value));
        }