All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cdk8s.plus.ServicePort Maven / Gradle / Ivy

There is a newer version: 0.33.0
Show newest version
package org.cdk8s.plus;

/**
 * Definition of a service port.
 * 

* EXPERIMENTAL */ @javax.annotation.Generated(value = "jsii-pacmak/1.7.0 (build 179a3a5)", date = "2020-06-29T13:29:38.534Z") @software.amazon.jsii.Jsii(module = org.cdk8s.plus.$Module.class, fqn = "cdk8s-plus.ServicePort") @software.amazon.jsii.Jsii.Proxy(ServicePort.Jsii$Proxy.class) @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public interface ServicePort extends software.amazon.jsii.JsiiSerializable, org.cdk8s.plus.ServicePortOptions { /** * 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(); /** * @return a {@link Builder} of {@link ServicePort} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) static Builder builder() { return new Builder(); } /** * A builder for {@link ServicePort} */ @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 java.lang.String name; private java.lang.Number nodePort; private org.cdk8s.plus.Protocol protocol; private java.lang.Number targetPort; /** * Sets the value of {@link ServicePort#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 ServicePort#getName} * @param name The name of this port within the service. * This must be a DNS_LABEL. All * ports within a ServiceSpec must have unique names. This maps to the 'Name' * field in EndpointPort objects. Optional if only one ServicePort is defined * on this service. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder name(java.lang.String name) { this.name = name; return this; } /** * Sets the value of {@link ServicePort#getNodePort} * @param nodePort The port on each node on which this service is exposed when type=NodePort or LoadBalancer. * Usually assigned by the system. If specified, it will be * allocated to the service if unused or else creation of the service will * fail. Default is to auto-allocate a port if the ServiceType of this Service * requires one. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder nodePort(java.lang.Number nodePort) { this.nodePort = nodePort; return this; } /** * Sets the value of {@link ServicePort#getProtocol} * @param protocol The IP protocol for this port. * Supports "TCP", "UDP", and "SCTP". Default is TCP. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder protocol(org.cdk8s.plus.Protocol protocol) { this.protocol = protocol; return this; } /** * Sets the value of {@link ServicePort#getTargetPort} * @param targetPort The port number the service will redirect to. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder targetPort(java.lang.Number targetPort) { this.targetPort = targetPort; return this; } /** * Builds the configured instance. * @return a new instance of {@link ServicePort} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public ServicePort build() { return new Jsii$Proxy(port, name, nodePort, protocol, targetPort); } } /** * An implementation for {@link ServicePort} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ServicePort { private final java.lang.Number port; private final java.lang.String name; private final java.lang.Number nodePort; private final org.cdk8s.plus.Protocol protocol; private final java.lang.Number targetPort; /** * 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.name = this.jsiiGet("name", java.lang.String.class); this.nodePort = this.jsiiGet("nodePort", java.lang.Number.class); this.protocol = this.jsiiGet("protocol", org.cdk8s.plus.Protocol.class); this.targetPort = this.jsiiGet("targetPort", java.lang.Number.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 java.lang.String name, final java.lang.Number nodePort, final org.cdk8s.plus.Protocol protocol, final java.lang.Number targetPort) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.port = java.util.Objects.requireNonNull(port, "port is required"); this.name = name; this.nodePort = nodePort; this.protocol = protocol; this.targetPort = targetPort; } @Override public java.lang.Number getPort() { return this.port; } @Override public java.lang.String getName() { return this.name; } @Override public java.lang.Number getNodePort() { return this.nodePort; } @Override public org.cdk8s.plus.Protocol getProtocol() { return this.protocol; } @Override public java.lang.Number getTargetPort() { return this.targetPort; } @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.getName() != null) { data.set("name", om.valueToTree(this.getName())); } if (this.getNodePort() != null) { data.set("nodePort", om.valueToTree(this.getNodePort())); } if (this.getProtocol() != null) { data.set("protocol", om.valueToTree(this.getProtocol())); } if (this.getTargetPort() != null) { data.set("targetPort", om.valueToTree(this.getTargetPort())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("cdk8s-plus.ServicePort")); 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; ServicePort.Jsii$Proxy that = (ServicePort.Jsii$Proxy) o; if (!port.equals(that.port)) return false; if (this.name != null ? !this.name.equals(that.name) : that.name != null) return false; if (this.nodePort != null ? !this.nodePort.equals(that.nodePort) : that.nodePort != null) return false; if (this.protocol != null ? !this.protocol.equals(that.protocol) : that.protocol != null) return false; return this.targetPort != null ? this.targetPort.equals(that.targetPort) : that.targetPort == null; } @Override public int hashCode() { int result = this.port.hashCode(); result = 31 * result + (this.name != null ? this.name.hashCode() : 0); result = 31 * result + (this.nodePort != null ? this.nodePort.hashCode() : 0); result = 31 * result + (this.protocol != null ? this.protocol.hashCode() : 0); result = 31 * result + (this.targetPort != null ? this.targetPort.hashCode() : 0); return result; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy