software.amazon.awscdk.services.gamelift.alpha.PortProps Maven / Gradle / Ivy
Show all versions of gamelift-alpha Show documentation
package software.amazon.awscdk.services.gamelift.alpha;
/**
* (experimental) Properties to create a port range.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.services.gamelift.alpha.*;
* PortProps portProps = PortProps.builder()
* .fromPort(123)
* .protocol(Protocol.TCP)
* // the properties below are optional
* .toPort(123)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-08-23T05:56:25.540Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.gamelift.alpha.$Module.class, fqn = "@aws-cdk/aws-gamelift-alpha.PortProps")
@software.amazon.jsii.Jsii.Proxy(PortProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface PortProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) A starting value for a range of allowed port numbers.
*
* For fleets using Windows and Linux builds, only ports 1026-60000 are valid.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getFromPort();
/**
* (experimental) The protocol for the range.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.gamelift.alpha.Protocol getProtocol();
/**
* (experimental) An ending value for a range of allowed port numbers.
*
* Port numbers are end-inclusive.
* This value must be higher than fromPort
.
*
* For fleets using Windows and Linux builds, only ports 1026-60000 are valid.
*
* Default: the `fromPort` value
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getToPort() {
return null;
}
/**
* @return a {@link Builder} of {@link PortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link PortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number fromPort;
software.amazon.awscdk.services.gamelift.alpha.Protocol protocol;
java.lang.Number toPort;
/**
* Sets the value of {@link PortProps#getFromPort}
* @param fromPort A starting value for a range of allowed port numbers. This parameter is required.
* For fleets using Windows and Linux builds, only ports 1026-60000 are valid.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder fromPort(java.lang.Number fromPort) {
this.fromPort = fromPort;
return this;
}
/**
* Sets the value of {@link PortProps#getProtocol}
* @param protocol The protocol for the range. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder protocol(software.amazon.awscdk.services.gamelift.alpha.Protocol protocol) {
this.protocol = protocol;
return this;
}
/**
* Sets the value of {@link PortProps#getToPort}
* @param toPort An ending value for a range of allowed port numbers.
* Port numbers are end-inclusive.
* This value must be higher than fromPort
.
*
* For fleets using Windows and Linux builds, only ports 1026-60000 are valid.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder toPort(java.lang.Number toPort) {
this.toPort = toPort;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link PortProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public PortProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link PortProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements PortProps {
private final java.lang.Number fromPort;
private final software.amazon.awscdk.services.gamelift.alpha.Protocol protocol;
private final java.lang.Number toPort;
/**
* 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.fromPort = software.amazon.jsii.Kernel.get(this, "fromPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.protocol = software.amazon.jsii.Kernel.get(this, "protocol", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.gamelift.alpha.Protocol.class));
this.toPort = software.amazon.jsii.Kernel.get(this, "toPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.fromPort = java.util.Objects.requireNonNull(builder.fromPort, "fromPort is required");
this.protocol = java.util.Objects.requireNonNull(builder.protocol, "protocol is required");
this.toPort = builder.toPort;
}
@Override
public final java.lang.Number getFromPort() {
return this.fromPort;
}
@Override
public final software.amazon.awscdk.services.gamelift.alpha.Protocol getProtocol() {
return this.protocol;
}
@Override
public final java.lang.Number getToPort() {
return this.toPort;
}
@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();
data.set("fromPort", om.valueToTree(this.getFromPort()));
data.set("protocol", om.valueToTree(this.getProtocol()));
if (this.getToPort() != null) {
data.set("toPort", om.valueToTree(this.getToPort()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-gamelift-alpha.PortProps"));
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;
PortProps.Jsii$Proxy that = (PortProps.Jsii$Proxy) o;
if (!fromPort.equals(that.fromPort)) return false;
if (!protocol.equals(that.protocol)) return false;
return this.toPort != null ? this.toPort.equals(that.toPort) : that.toPort == null;
}
@Override
public final int hashCode() {
int result = this.fromPort.hashCode();
result = 31 * result + (this.protocol.hashCode());
result = 31 * result + (this.toPort != null ? this.toPort.hashCode() : 0);
return result;
}
}
}