Record Class ApplicationSpec.OptionalPort

java.lang.Object
java.lang.Record
com.cloudforge.core.interfaces.ApplicationSpec.OptionalPort
Record Components:
port - The port number
protocol - The protocol ("tcp" or "udp")
configKey - The DeploymentContext key to enable this port (e.g., "enableSmtp")
service - Human-readable service name for logging/prompts
inbound - 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 Details

    • OptionalPort

      public OptionalPort(int port, String protocol, String configKey, String service, boolean inbound)
      Creates an instance of a OptionalPort record class.
      Parameters:
      port - the value for the port record component
      protocol - the value for the protocol record component
      configKey - the value for the configKey record component
      service - the value for the service record component
      inbound - the value for the inbound record component
  • Method Details

    • inboundTcp

      public static ApplicationSpec.OptionalPort inboundTcp(int port, String configKey, String service)
      Convenience constructor for inbound TCP ports.
      Parameters:
      port - the port number
      configKey - the deployment config key to enable this port
      service - the service name using this port
      Returns:
      an OptionalPort configured for inbound TCP
    • outboundTcp

      public static ApplicationSpec.OptionalPort outboundTcp(int port, String configKey, String service)
      Convenience constructor for outbound TCP ports (no security group rule needed).
      Parameters:
      port - the port number
      configKey - the deployment config key to enable this port
      service - the service name using this port
      Returns:
      an OptionalPort configured for outbound TCP
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • port

      public int port()
      Returns the value of the port record component.
      Returns:
      the value of the port record component
    • protocol

      public String protocol()
      Returns the value of the protocol record component.
      Returns:
      the value of the protocol record component
    • configKey

      public String configKey()
      Returns the value of the configKey record component.
      Returns:
      the value of the configKey record component
    • service

      public String service()
      Returns the value of the service record component.
      Returns:
      the value of the service record component
    • inbound

      public boolean inbound()
      Returns the value of the inbound record component.
      Returns:
      the value of the inbound record component