
org.cdk8s.plus31.NetworkPolicyPortProps Maven / Gradle / Ivy
package org.cdk8s.plus31;
/**
* Properties for NetworkPolicyPort
.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T12:15:24.862Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus31.$Module.class, fqn = "cdk8s-plus-31.NetworkPolicyPortProps")
@software.amazon.jsii.Jsii.Proxy(NetworkPolicyPortProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface NetworkPolicyPortProps extends software.amazon.jsii.JsiiSerializable {
/**
* End port (relative to port
).
*
* Only applies if port
is defined.
* Use this to specify a port range, rather that a specific one.
*
* Default: - not a port range.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getEndPort() {
return null;
}
/**
* Specific port number.
*
* Default: - all ports are allowed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getPort() {
return null;
}
/**
* Protocol.
*
* Default: NetworkProtocol.TCP
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.NetworkProtocol getProtocol() {
return null;
}
/**
* @return a {@link Builder} of {@link NetworkPolicyPortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link NetworkPolicyPortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number endPort;
java.lang.Number port;
org.cdk8s.plus31.NetworkProtocol protocol;
/**
* Sets the value of {@link NetworkPolicyPortProps#getEndPort}
* @param endPort End port (relative to port
).
* Only applies if port
is defined.
* Use this to specify a port range, rather that a specific one.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder endPort(java.lang.Number endPort) {
this.endPort = endPort;
return this;
}
/**
* Sets the value of {@link NetworkPolicyPortProps#getPort}
* @param port Specific port number.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder port(java.lang.Number port) {
this.port = port;
return this;
}
/**
* Sets the value of {@link NetworkPolicyPortProps#getProtocol}
* @param protocol Protocol.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder protocol(org.cdk8s.plus31.NetworkProtocol protocol) {
this.protocol = protocol;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link NetworkPolicyPortProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public NetworkPolicyPortProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link NetworkPolicyPortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements NetworkPolicyPortProps {
private final java.lang.Number endPort;
private final java.lang.Number port;
private final org.cdk8s.plus31.NetworkProtocol protocol;
/**
* 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.endPort = software.amazon.jsii.Kernel.get(this, "endPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.port = software.amazon.jsii.Kernel.get(this, "port", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.protocol = software.amazon.jsii.Kernel.get(this, "protocol", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.NetworkProtocol.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.endPort = builder.endPort;
this.port = builder.port;
this.protocol = builder.protocol;
}
@Override
public final java.lang.Number getEndPort() {
return this.endPort;
}
@Override
public final java.lang.Number getPort() {
return this.port;
}
@Override
public final org.cdk8s.plus31.NetworkProtocol getProtocol() {
return this.protocol;
}
@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.getEndPort() != null) {
data.set("endPort", om.valueToTree(this.getEndPort()));
}
if (this.getPort() != null) {
data.set("port", om.valueToTree(this.getPort()));
}
if (this.getProtocol() != null) {
data.set("protocol", om.valueToTree(this.getProtocol()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s-plus-31.NetworkPolicyPortProps"));
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;
NetworkPolicyPortProps.Jsii$Proxy that = (NetworkPolicyPortProps.Jsii$Proxy) o;
if (this.endPort != null ? !this.endPort.equals(that.endPort) : that.endPort != null) return false;
if (this.port != null ? !this.port.equals(that.port) : that.port != null) return false;
return this.protocol != null ? this.protocol.equals(that.protocol) : that.protocol == null;
}
@Override
public final int hashCode() {
int result = this.endPort != null ? this.endPort.hashCode() : 0;
result = 31 * result + (this.port != null ? this.port.hashCode() : 0);
result = 31 * result + (this.protocol != null ? this.protocol.hashCode() : 0);
return result;
}
}
}