org.cdk8s.plus22.ProbeOptions Maven / Gradle / Ivy
Show all versions of cdk8s-plus-22 Show documentation
package org.cdk8s.plus22;
/**
* Probe options.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.47.0 (build 86d2c33)", date = "2021-12-08T00:16:55.115Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus22.$Module.class, fqn = "cdk8s-plus-22.ProbeOptions")
@software.amazon.jsii.Jsii.Proxy(ProbeOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface ProbeOptions extends software.amazon.jsii.JsiiSerializable {
/**
* Minimum consecutive failures for the probe to be considered failed after having succeeded.
*
* Defaults to 3. Minimum value is 1.
*
* Default: 3
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getFailureThreshold() {
return null;
}
/**
* Number of seconds after the container has started before liveness probes are initiated.
*
* Default: - immediate
*
* @see https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.Duration getInitialDelaySeconds() {
return null;
}
/**
* How often (in seconds) to perform the probe.
*
* Default to 10 seconds. Minimum value is 1.
*
* Default: Duration.seconds(10) Minimum value is 1.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.Duration getPeriodSeconds() {
return null;
}
/**
* Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1.
*
* Must be 1 for liveness and startup. Minimum value is 1.
*
* Default: 1 Must be 1 for liveness and startup. Minimum value is 1.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getSuccessThreshold() {
return null;
}
/**
* Number of seconds after which the probe times out.
*
* Defaults to 1 second. Minimum value is 1.
*
* Default: Duration.seconds(1)
*
* @see https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.Duration getTimeoutSeconds() {
return null;
}
/**
* @return a {@link Builder} of {@link ProbeOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ProbeOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number failureThreshold;
org.cdk8s.Duration initialDelaySeconds;
org.cdk8s.Duration periodSeconds;
java.lang.Number successThreshold;
org.cdk8s.Duration timeoutSeconds;
/**
* Sets the value of {@link ProbeOptions#getFailureThreshold}
* @param failureThreshold Minimum consecutive failures for the probe to be considered failed after having succeeded.
* Defaults to 3. Minimum value is 1.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder failureThreshold(java.lang.Number failureThreshold) {
this.failureThreshold = failureThreshold;
return this;
}
/**
* Sets the value of {@link ProbeOptions#getInitialDelaySeconds}
* @param initialDelaySeconds Number of seconds after the container has started before liveness probes are initiated.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder initialDelaySeconds(org.cdk8s.Duration initialDelaySeconds) {
this.initialDelaySeconds = initialDelaySeconds;
return this;
}
/**
* Sets the value of {@link ProbeOptions#getPeriodSeconds}
* @param periodSeconds How often (in seconds) to perform the probe.
* Default to 10 seconds. Minimum value is 1.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder periodSeconds(org.cdk8s.Duration periodSeconds) {
this.periodSeconds = periodSeconds;
return this;
}
/**
* Sets the value of {@link ProbeOptions#getSuccessThreshold}
* @param successThreshold Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1.
* Must be 1 for liveness and startup. Minimum value is 1.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder successThreshold(java.lang.Number successThreshold) {
this.successThreshold = successThreshold;
return this;
}
/**
* Sets the value of {@link ProbeOptions#getTimeoutSeconds}
* @param timeoutSeconds Number of seconds after which the probe times out.
* Defaults to 1 second. Minimum value is 1.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder timeoutSeconds(org.cdk8s.Duration timeoutSeconds) {
this.timeoutSeconds = timeoutSeconds;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ProbeOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public ProbeOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ProbeOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ProbeOptions {
private final java.lang.Number failureThreshold;
private final org.cdk8s.Duration initialDelaySeconds;
private final org.cdk8s.Duration periodSeconds;
private final java.lang.Number successThreshold;
private final org.cdk8s.Duration timeoutSeconds;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.failureThreshold = software.amazon.jsii.Kernel.get(this, "failureThreshold", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.initialDelaySeconds = software.amazon.jsii.Kernel.get(this, "initialDelaySeconds", software.amazon.jsii.NativeType.forClass(org.cdk8s.Duration.class));
this.periodSeconds = software.amazon.jsii.Kernel.get(this, "periodSeconds", software.amazon.jsii.NativeType.forClass(org.cdk8s.Duration.class));
this.successThreshold = software.amazon.jsii.Kernel.get(this, "successThreshold", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.timeoutSeconds = software.amazon.jsii.Kernel.get(this, "timeoutSeconds", software.amazon.jsii.NativeType.forClass(org.cdk8s.Duration.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.failureThreshold = builder.failureThreshold;
this.initialDelaySeconds = builder.initialDelaySeconds;
this.periodSeconds = builder.periodSeconds;
this.successThreshold = builder.successThreshold;
this.timeoutSeconds = builder.timeoutSeconds;
}
@Override
public final java.lang.Number getFailureThreshold() {
return this.failureThreshold;
}
@Override
public final org.cdk8s.Duration getInitialDelaySeconds() {
return this.initialDelaySeconds;
}
@Override
public final org.cdk8s.Duration getPeriodSeconds() {
return this.periodSeconds;
}
@Override
public final java.lang.Number getSuccessThreshold() {
return this.successThreshold;
}
@Override
public final org.cdk8s.Duration getTimeoutSeconds() {
return this.timeoutSeconds;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getFailureThreshold() != null) {
data.set("failureThreshold", om.valueToTree(this.getFailureThreshold()));
}
if (this.getInitialDelaySeconds() != null) {
data.set("initialDelaySeconds", om.valueToTree(this.getInitialDelaySeconds()));
}
if (this.getPeriodSeconds() != null) {
data.set("periodSeconds", om.valueToTree(this.getPeriodSeconds()));
}
if (this.getSuccessThreshold() != null) {
data.set("successThreshold", om.valueToTree(this.getSuccessThreshold()));
}
if (this.getTimeoutSeconds() != null) {
data.set("timeoutSeconds", om.valueToTree(this.getTimeoutSeconds()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s-plus-22.ProbeOptions"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProbeOptions.Jsii$Proxy that = (ProbeOptions.Jsii$Proxy) o;
if (this.failureThreshold != null ? !this.failureThreshold.equals(that.failureThreshold) : that.failureThreshold != null) return false;
if (this.initialDelaySeconds != null ? !this.initialDelaySeconds.equals(that.initialDelaySeconds) : that.initialDelaySeconds != null) return false;
if (this.periodSeconds != null ? !this.periodSeconds.equals(that.periodSeconds) : that.periodSeconds != null) return false;
if (this.successThreshold != null ? !this.successThreshold.equals(that.successThreshold) : that.successThreshold != null) return false;
return this.timeoutSeconds != null ? this.timeoutSeconds.equals(that.timeoutSeconds) : that.timeoutSeconds == null;
}
@Override
public final int hashCode() {
int result = this.failureThreshold != null ? this.failureThreshold.hashCode() : 0;
result = 31 * result + (this.initialDelaySeconds != null ? this.initialDelaySeconds.hashCode() : 0);
result = 31 * result + (this.periodSeconds != null ? this.periodSeconds.hashCode() : 0);
result = 31 * result + (this.successThreshold != null ? this.successThreshold.hashCode() : 0);
result = 31 * result + (this.timeoutSeconds != null ? this.timeoutSeconds.hashCode() : 0);
return result;
}
}
}