Package com.cloudforgeci.api.core.rules
Record Class ComplianceRule
java.lang.Object
java.lang.Record
com.cloudforgeci.api.core.rules.ComplianceRule
- Record Components:
ruleId- Unique identifier for this compliance rule (e.g., "SOC2-CC6.1", "PCI-DSS-Req3.4")description- Human-readable description of the requirementconfigRuleId- Optional AWS Config rule ID that monitors this requirementpassed- Whether the validation check passederrorMessage- Optional error message if validation failed
public record ComplianceRule(String ruleId, String description, Optional<String> configRuleId, boolean passed, Optional<String> errorMessage)
extends Record
Represents a compliance rule with its validation status and AWS Config rule mapping.
This structured approach links compliance validation to actual AWS Config rules, providing traceability between framework requirements and infrastructure monitoring.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfigRuleIdrecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorMessagerecord component.static ComplianceRuleCreate a failing compliance rule with error message.static ComplianceRuleCreate a failing compliance rule with Config rule mapping.final inthashCode()Returns a hash code value for this object.static ComplianceRuleCreate a passing compliance rule without Config rule mapping.static ComplianceRuleCreate a passing compliance rule.booleanpassed()Returns the value of thepassedrecord component.ruleId()Returns the value of theruleIdrecord component.Convert to legacy string error format for CDK validation.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ComplianceRule
public ComplianceRule(String ruleId, String description, Optional<String> configRuleId, boolean passed, Optional<String> errorMessage) Creates an instance of aComplianceRulerecord class.- Parameters:
ruleId- the value for theruleIdrecord componentdescription- the value for thedescriptionrecord componentconfigRuleId- the value for theconfigRuleIdrecord componentpassed- the value for thepassedrecord componenterrorMessage- the value for theerrorMessagerecord component
-
-
Method Details
-
pass
Create a passing compliance rule. -
pass
Create a passing compliance rule without Config rule mapping. -
fail
Create a failing compliance rule with error message. -
fail
public static ComplianceRule fail(String ruleId, String description, String configRuleId, String errorMessage) Create a failing compliance rule with Config rule mapping. -
toErrorString
Convert to legacy string error format for CDK validation. -
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 '=='. -
ruleId
Returns the value of theruleIdrecord component.- Returns:
- the value of the
ruleIdrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
configRuleId
Returns the value of theconfigRuleIdrecord component.- Returns:
- the value of the
configRuleIdrecord component
-
passed
public boolean passed()Returns the value of thepassedrecord component.- Returns:
- the value of the
passedrecord component
-
errorMessage
Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-