Record Class DatabaseSpec.DatabaseRequirement

java.lang.Object
java.lang.Record
com.cloudforge.core.interfaces.DatabaseSpec.DatabaseRequirement
Record Components:
type - the requirement type (REQUIRED, OPTIONAL, or NONE)
engine - the database engine (e.g., "postgres", "mysql")
version - the minimum database engine version the application supports. It is also the version provisioned when the deployment does not choose one; a deployment may select a higher version but never a lower one (see meetsMinimum(String))
instanceClass - the RDS instance class (e.g., "db.t3.micro")
allocatedStorageGB - the allocated storage in GB
databaseName - the name of the database to create
publiclyAccessible - whether the database should be publicly accessible
defaultVersion - the version provisioned when the deployment does not choose one, or null to use version. It must not be lower than version; use it when the minimum is an engine release the database service no longer supports
testedMaxVersion - the newest version this application has been verified against, or null when no upper bound has been established. A higher version is still accepted; it is flagged as untested
Enclosing interface:
DatabaseSpec

public static record DatabaseSpec.DatabaseRequirement(DatabaseSpec.DatabaseRequirement.RequirementType type, String engine, String version, String instanceClass, int allocatedStorageGB, String databaseName, boolean publiclyAccessible, String defaultVersion, String testedMaxVersion) extends Record
Database requirement specification.
Since:
3.0.0
  • Constructor Details

  • Method Details

    • meetsMinimum

      public boolean meetsMinimum(String candidate)
      Whether candidate is at least this requirement's minimum version(). Versions are compared segment by segment as numbers ("17" < "17.2" < "18"; "8.0" equals "8.0.0"). A version that cannot be read as dotted numbers is not rejected, because engine-specific suffixes should not block a deployment on a guess.
    • compareVersions

      public static int compareVersions(String a, String b)
      Compares dotted numeric versions segment by segment; a missing segment counts as 0. Returns 0 when either side has a segment that does not start with a digit.
    • required

      public static DatabaseSpec.DatabaseRequirement required(String engine, String version)
    • optional

      public static DatabaseSpec.DatabaseRequirement optional(String engine, String version)
    • none

      public static DatabaseSpec.DatabaseRequirement none()
    • effectiveDefaultVersion

      public String effectiveDefaultVersion()
      The version provisioned when the deployment does not choose one.
    • exceedsTestedMax

      public boolean exceedsTestedMax(String candidate)
      Whether candidate is newer than the newest version this application has been verified against. Always false when no tested maximum has been recorded.
    • withDefaultVersion

      public DatabaseSpec.DatabaseRequirement withDefaultVersion(String defaultVersion)
      Sets the version provisioned by default; it may not be lower than the minimum.
    • withTestedMaxVersion

      public DatabaseSpec.DatabaseRequirement withTestedMaxVersion(String testedMaxVersion)
      Records the newest version this application has been verified against.
    • withInstanceClass

      public DatabaseSpec.DatabaseRequirement withInstanceClass(String instanceClass)
    • withStorage

      public DatabaseSpec.DatabaseRequirement withStorage(int allocatedStorageGB)
    • withDatabaseName

      public DatabaseSpec.DatabaseRequirement withDatabaseName(String databaseName)
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • type

      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • engine

      public String engine()
      Returns the value of the engine record component.
      Returns:
      the value of the engine record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • instanceClass

      public String instanceClass()
      Returns the value of the instanceClass record component.
      Returns:
      the value of the instanceClass record component
    • allocatedStorageGB

      public int allocatedStorageGB()
      Returns the value of the allocatedStorageGB record component.
      Returns:
      the value of the allocatedStorageGB record component
    • databaseName

      public String databaseName()
      Returns the value of the databaseName record component.
      Returns:
      the value of the databaseName record component
    • publiclyAccessible

      public boolean publiclyAccessible()
      Returns the value of the publiclyAccessible record component.
      Returns:
      the value of the publiclyAccessible record component
    • defaultVersion

      public String defaultVersion()
      Returns the value of the defaultVersion record component.
      Returns:
      the value of the defaultVersion record component
    • testedMaxVersion

      public String testedMaxVersion()
      Returns the value of the testedMaxVersion record component.
      Returns:
      the value of the testedMaxVersion record component