org.cdk8s.plus.ExposeOptions Maven / Gradle / Ivy
Show all versions of cdk8s-plus Show documentation
package org.cdk8s.plus;
/**
* Options for exposing a deployment via a service.
*
* EXPERIMENTAL
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.7.0 (build 179a3a5)", date = "2020-06-29T13:29:38.497Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus.$Module.class, fqn = "cdk8s-plus.ExposeOptions")
@software.amazon.jsii.Jsii.Proxy(ExposeOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ExposeOptions extends software.amazon.jsii.JsiiSerializable {
/**
* The port number the service will bind to.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getPort();
/**
* The type of the exposed service.
*
* Default: - ClusterIP.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus.ServiceType getServiceType() {
return null;
}
/**
* @return a {@link Builder} of {@link ExposeOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ExposeOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
private java.lang.Number port;
private org.cdk8s.plus.ServiceType serviceType;
/**
* Sets the value of {@link ExposeOptions#getPort}
* @param port The port number the service will bind to. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder port(java.lang.Number port) {
this.port = port;
return this;
}
/**
* Sets the value of {@link ExposeOptions#getServiceType}
* @param serviceType The type of the exposed service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder serviceType(org.cdk8s.plus.ServiceType serviceType) {
this.serviceType = serviceType;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ExposeOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ExposeOptions build() {
return new Jsii$Proxy(port, serviceType);
}
}
/**
* An implementation for {@link ExposeOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ExposeOptions {
private final java.lang.Number port;
private final org.cdk8s.plus.ServiceType serviceType;
/**
* 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.port = this.jsiiGet("port", java.lang.Number.class);
this.serviceType = this.jsiiGet("serviceType", org.cdk8s.plus.ServiceType.class);
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
private Jsii$Proxy(final java.lang.Number port, final org.cdk8s.plus.ServiceType serviceType) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.port = java.util.Objects.requireNonNull(port, "port is required");
this.serviceType = serviceType;
}
@Override
public java.lang.Number getPort() {
return this.port;
}
@Override
public org.cdk8s.plus.ServiceType getServiceType() {
return this.serviceType;
}
@Override
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();
data.set("port", om.valueToTree(this.getPort()));
if (this.getServiceType() != null) {
data.set("serviceType", om.valueToTree(this.getServiceType()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s-plus.ExposeOptions"));
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 boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExposeOptions.Jsii$Proxy that = (ExposeOptions.Jsii$Proxy) o;
if (!port.equals(that.port)) return false;
return this.serviceType != null ? this.serviceType.equals(that.serviceType) : that.serviceType == null;
}
@Override
public int hashCode() {
int result = this.port.hashCode();
result = 31 * result + (this.serviceType != null ? this.serviceType.hashCode() : 0);
return result;
}
}
}