Beispiel #1
0
 internal ContainerProbe(ContainerExec exec, ContainerHttpGet httpGet, int?initialDelaySeconds, int?periodSeconds, int?failureThreshold, int?successThreshold, int?timeoutSeconds)
 {
     Exec                = exec;
     HttpGet             = httpGet;
     InitialDelaySeconds = initialDelaySeconds;
     PeriodSeconds       = periodSeconds;
     FailureThreshold    = failureThreshold;
     SuccessThreshold    = successThreshold;
     TimeoutSeconds      = timeoutSeconds;
 }
Beispiel #2
0
        internal static ContainerProbe DeserializeContainerProbe(JsonElement element)
        {
            Optional <ContainerExec>    exec    = default;
            Optional <ContainerHttpGet> httpGet = default;
            Optional <int> initialDelaySeconds  = default;
            Optional <int> periodSeconds        = default;
            Optional <int> failureThreshold     = default;
            Optional <int> successThreshold     = default;
            Optional <int> timeoutSeconds       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("exec"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    exec = ContainerExec.DeserializeContainerExec(property.Value);
                    continue;
                }
                if (property.NameEquals("httpGet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    httpGet = ContainerHttpGet.DeserializeContainerHttpGet(property.Value);
                    continue;
                }
                if (property.NameEquals("initialDelaySeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    initialDelaySeconds = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("periodSeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    periodSeconds = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("failureThreshold"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    failureThreshold = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("successThreshold"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    successThreshold = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("timeoutSeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    timeoutSeconds = property.Value.GetInt32();
                    continue;
                }
            }
            return(new ContainerProbe(exec.Value, httpGet.Value, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(failureThreshold), Optional.ToNullable(successThreshold), Optional.ToNullable(timeoutSeconds)));
        }