
org.cdk8s.plus31.k8s.LifecycleHandler Maven / Gradle / Ivy
package org.cdk8s.plus31.k8s;
/**
* LifecycleHandler defines a specific action that should be taken in a lifecycle hook.
*
* One and only one of the fields, except TCPSocket must be specified.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-10-12T12:14:17.663Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus31.$Module.class, fqn = "cdk8s-plus-31.k8s.LifecycleHandler")
@software.amazon.jsii.Jsii.Proxy(LifecycleHandler.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface LifecycleHandler extends software.amazon.jsii.JsiiSerializable {
/**
* Exec specifies the action to take.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.k8s.ExecAction getExec() {
return null;
}
/**
* HTTPGet specifies the http request to perform.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.k8s.HttpGetAction getHttpGet() {
return null;
}
/**
* Sleep represents the duration that the container should sleep before being terminated.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.k8s.SleepAction getSleep() {
return null;
}
/**
* Deprecated.
*
* TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.k8s.TcpSocketAction getTcpSocket() {
return null;
}
/**
* @return a {@link Builder} of {@link LifecycleHandler}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link LifecycleHandler}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
org.cdk8s.plus31.k8s.ExecAction exec;
org.cdk8s.plus31.k8s.HttpGetAction httpGet;
org.cdk8s.plus31.k8s.SleepAction sleep;
org.cdk8s.plus31.k8s.TcpSocketAction tcpSocket;
/**
* Sets the value of {@link LifecycleHandler#getExec}
* @param exec Exec specifies the action to take.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder exec(org.cdk8s.plus31.k8s.ExecAction exec) {
this.exec = exec;
return this;
}
/**
* Sets the value of {@link LifecycleHandler#getHttpGet}
* @param httpGet HTTPGet specifies the http request to perform.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder httpGet(org.cdk8s.plus31.k8s.HttpGetAction httpGet) {
this.httpGet = httpGet;
return this;
}
/**
* Sets the value of {@link LifecycleHandler#getSleep}
* @param sleep Sleep represents the duration that the container should sleep before being terminated.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder sleep(org.cdk8s.plus31.k8s.SleepAction sleep) {
this.sleep = sleep;
return this;
}
/**
* Sets the value of {@link LifecycleHandler#getTcpSocket}
* @param tcpSocket Deprecated.
* TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder tcpSocket(org.cdk8s.plus31.k8s.TcpSocketAction tcpSocket) {
this.tcpSocket = tcpSocket;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link LifecycleHandler}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public LifecycleHandler build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link LifecycleHandler}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements LifecycleHandler {
private final org.cdk8s.plus31.k8s.ExecAction exec;
private final org.cdk8s.plus31.k8s.HttpGetAction httpGet;
private final org.cdk8s.plus31.k8s.SleepAction sleep;
private final org.cdk8s.plus31.k8s.TcpSocketAction tcpSocket;
/**
* 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.exec = software.amazon.jsii.Kernel.get(this, "exec", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.ExecAction.class));
this.httpGet = software.amazon.jsii.Kernel.get(this, "httpGet", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.HttpGetAction.class));
this.sleep = software.amazon.jsii.Kernel.get(this, "sleep", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.SleepAction.class));
this.tcpSocket = software.amazon.jsii.Kernel.get(this, "tcpSocket", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.TcpSocketAction.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.exec = builder.exec;
this.httpGet = builder.httpGet;
this.sleep = builder.sleep;
this.tcpSocket = builder.tcpSocket;
}
@Override
public final org.cdk8s.plus31.k8s.ExecAction getExec() {
return this.exec;
}
@Override
public final org.cdk8s.plus31.k8s.HttpGetAction getHttpGet() {
return this.httpGet;
}
@Override
public final org.cdk8s.plus31.k8s.SleepAction getSleep() {
return this.sleep;
}
@Override
public final org.cdk8s.plus31.k8s.TcpSocketAction getTcpSocket() {
return this.tcpSocket;
}
@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.getExec() != null) {
data.set("exec", om.valueToTree(this.getExec()));
}
if (this.getHttpGet() != null) {
data.set("httpGet", om.valueToTree(this.getHttpGet()));
}
if (this.getSleep() != null) {
data.set("sleep", om.valueToTree(this.getSleep()));
}
if (this.getTcpSocket() != null) {
data.set("tcpSocket", om.valueToTree(this.getTcpSocket()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s-plus-31.k8s.LifecycleHandler"));
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;
LifecycleHandler.Jsii$Proxy that = (LifecycleHandler.Jsii$Proxy) o;
if (this.exec != null ? !this.exec.equals(that.exec) : that.exec != null) return false;
if (this.httpGet != null ? !this.httpGet.equals(that.httpGet) : that.httpGet != null) return false;
if (this.sleep != null ? !this.sleep.equals(that.sleep) : that.sleep != null) return false;
return this.tcpSocket != null ? this.tcpSocket.equals(that.tcpSocket) : that.tcpSocket == null;
}
@Override
public final int hashCode() {
int result = this.exec != null ? this.exec.hashCode() : 0;
result = 31 * result + (this.httpGet != null ? this.httpGet.hashCode() : 0);
result = 31 * result + (this.sleep != null ? this.sleep.hashCode() : 0);
result = 31 * result + (this.tcpSocket != null ? this.tcpSocket.hashCode() : 0);
return result;
}
}
}