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 (seemeetsMinimum(String))instanceClass- the RDS instance class (e.g., "db.t3.micro")allocatedStorageGB- the allocated storage in GBdatabaseName- the name of the database to createpubliclyAccessible- whether the database should be publicly accessibledefaultVersion- the version provisioned when the deployment does not choose one, or null to useversion. It must not be lower thanversion; use it when the minimum is an engine release the database service no longer supportstestedMaxVersion- 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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDatabaseRequirement(DatabaseSpec.DatabaseRequirement.RequirementType type, String engine, String version, String instanceClass, int allocatedStorageGB, String databaseName, boolean publiclyAccessible, String defaultVersion, String testedMaxVersion) Creates an instance of aDatabaseRequirementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theallocatedStorageGBrecord component.static intcompareVersions(String a, String b) Compares dotted numeric versions segment by segment; a missing segment counts as 0.Returns the value of thedatabaseNamerecord component.Returns the value of thedefaultVersionrecord component.The version provisioned when the deployment does not choose one.engine()Returns the value of theenginerecord component.final booleanIndicates whether some other object is "equal to" this one.booleanexceedsTestedMax(String candidate) Whethercandidateis newer than the newest version this application has been verified against.final inthashCode()Returns a hash code value for this object.Returns the value of theinstanceClassrecord component.booleanmeetsMinimum(String candidate) Whethercandidateis at least this requirement's minimumversion().none()booleanReturns the value of thepubliclyAccessiblerecord component.Returns the value of thetestedMaxVersionrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.version()Returns the value of theversionrecord component.withDatabaseName(String databaseName) withDefaultVersion(String defaultVersion) Sets the version provisioned by default; it may not be lower than the minimum.withInstanceClass(String instanceClass) withStorage(int allocatedStorageGB) withTestedMaxVersion(String testedMaxVersion) Records the newest version this application has been verified against.
-
Constructor Details
-
DatabaseRequirement
public DatabaseRequirement(DatabaseSpec.DatabaseRequirement.RequirementType type, String engine, String version, String instanceClass, int allocatedStorageGB, String databaseName, boolean publiclyAccessible, String defaultVersion, String testedMaxVersion) Creates an instance of aDatabaseRequirementrecord class.- Parameters:
type- the value for thetyperecord componentengine- the value for theenginerecord componentversion- the value for theversionrecord componentinstanceClass- the value for theinstanceClassrecord componentallocatedStorageGB- the value for theallocatedStorageGBrecord componentdatabaseName- the value for thedatabaseNamerecord componentpubliclyAccessible- the value for thepubliclyAccessiblerecord componentdefaultVersion- the value for thedefaultVersionrecord componenttestedMaxVersion- the value for thetestedMaxVersionrecord component
-
-
Method Details
-
meetsMinimum
Whethercandidateis at least this requirement's minimumversion(). 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
-
required
-
optional
-
none
-
effectiveDefaultVersion
The version provisioned when the deployment does not choose one. -
exceedsTestedMax
Whethercandidateis newer than the newest version this application has been verified against. Always false when no tested maximum has been recorded. -
withDefaultVersion
Sets the version provisioned by default; it may not be lower than the minimum. -
withTestedMaxVersion
Records the newest version this application has been verified against. -
withInstanceClass
-
withStorage
-
withDatabaseName
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
type
-
engine
-
version
-
instanceClass
Returns the value of theinstanceClassrecord component.- Returns:
- the value of the
instanceClassrecord component
-
allocatedStorageGB
public int allocatedStorageGB()Returns the value of theallocatedStorageGBrecord component.- Returns:
- the value of the
allocatedStorageGBrecord component
-
databaseName
Returns the value of thedatabaseNamerecord component.- Returns:
- the value of the
databaseNamerecord component
-
publiclyAccessible
public boolean publiclyAccessible()Returns the value of thepubliclyAccessiblerecord component.- Returns:
- the value of the
publiclyAccessiblerecord component
-
defaultVersion
Returns the value of thedefaultVersionrecord component.- Returns:
- the value of the
defaultVersionrecord component
-
testedMaxVersion
Returns the value of thetestedMaxVersionrecord component.- Returns:
- the value of the
testedMaxVersionrecord component
-