Package com.cloudforge.core.interfaces
Record Class ApplicationSpec.OptionalPort
java.lang.Object
java.lang.Record
com.cloudforge.core.interfaces.ApplicationSpec.OptionalPort
- Record Components:
port- The port numberprotocol- The protocol ("tcp" or "udp")configKey- The DeploymentContext key to enable this port (e.g., "enableSmtp")service- Human-readable service name for logging/promptsinbound- true if port accepts inbound connections (requires security group rule), false if outbound only (container connects out, no SG rule needed)
- Enclosing interface:
ApplicationSpec
public static record ApplicationSpec.OptionalPort(int port, String protocol, String configKey, String service, boolean inbound)
extends Record
Optional service port that can be enabled via deployment configuration.
Ports are NOT exposed by default - must be explicitly enabled via the configKey in deployment configuration. This follows the principle of least privilege.
-
Constructor Summary
ConstructorsConstructorDescriptionOptionalPort(int port, String protocol, String configKey, String service, boolean inbound) Creates an instance of aOptionalPortrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfigKeyrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleaninbound()Returns the value of theinboundrecord component.static ApplicationSpec.OptionalPortinboundTcp(int port, String configKey, String service) Convenience constructor for inbound TCP ports.static ApplicationSpec.OptionalPortoutboundTcp(int port, String configKey, String service) Convenience constructor for outbound TCP ports (no security group rule needed).intport()Returns the value of theportrecord component.protocol()Returns the value of theprotocolrecord component.service()Returns the value of theservicerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OptionalPort
Creates an instance of aOptionalPortrecord class.
-
-
Method Details
-
inboundTcp
Convenience constructor for inbound TCP ports.- Parameters:
port- the port numberconfigKey- the deployment config key to enable this portservice- the service name using this port- Returns:
- an OptionalPort configured for inbound TCP
-
outboundTcp
Convenience constructor for outbound TCP ports (no security group rule needed).- Parameters:
port- the port numberconfigKey- the deployment config key to enable this portservice- the service name using this port- Returns:
- an OptionalPort configured for outbound TCP
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
port
public int port()Returns the value of theportrecord component.- Returns:
- the value of the
portrecord component
-
protocol
Returns the value of theprotocolrecord component.- Returns:
- the value of the
protocolrecord component
-
configKey
Returns the value of theconfigKeyrecord component.- Returns:
- the value of the
configKeyrecord component
-
service
Returns the value of theservicerecord component.- Returns:
- the value of the
servicerecord component
-
inbound
public boolean inbound()Returns the value of theinboundrecord component.- Returns:
- the value of the
inboundrecord component
-