Class Validations
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Example:
App myApp; IPolicyValidationPlugin plugin; Validations.of(myApp).addPlugins(plugin);
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMetadata key used to store acknowledged rules on construct nodes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedValidations(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedValidations(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(Acknowledgment... rules) Acknowledge one or more rules, suppressing them from validation output.voidAdds an error metadata entry to this construct.voidaddPlugins(IPolicyValidationPlugin... plugins) Register one or more validation plugins that will be executed during synthesis.voidaddWarning(String id, String message) Adds a warning metadata entry to this construct that can be acknowledged.static Validationsof(software.constructs.IConstruct scope) Returns the Validations for the given construct scope.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
ACKNOWLEDGED_RULES_METADATA_KEY
Metadata key used to store acknowledged rules on construct nodes.Plugin authors can read this metadata to build audit trails from acknowledgments recorded via
acknowledge().
-
-
Constructor Details
-
Validations
protected Validations(software.amazon.jsii.JsiiObjectRef objRef) -
Validations
protected Validations(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
-
Method Details
-
of
@Stability(Stable) @NotNull public static Validations of(@NotNull software.constructs.IConstruct scope) Returns the Validations for the given construct scope.- Parameters:
scope- any construct. This parameter is required.
-
acknowledge
Acknowledge one or more rules, suppressing them from validation output.Acknowledgments are recorded to construct metadata so that downstream plugins (e.g. CDK Nag) can read them for audit trails.
Currently only annotation warnings can be suppressed. Annotation errors are not yet acknowledgeable.
If an ID has no well-known prefix, it is assumed to be an annotation rule for backwards compatibility.
- Parameters:
rules- the rules to acknowledge. This parameter is required.
-
addError
Adds an error metadata entry to this construct.Synthesis will be interrupted when errors are reported.
Note: Annotation errors are not currently acknowledgeable. The ID is recorded for identification purposes but
acknowledge()will not suppress errors added via this method.- Parameters:
id- unique identifier for the error. This parameter is required.message- the error message. This parameter is required.
-
addPlugins
Register one or more validation plugins that will be executed during synthesis.Plugins can only be registered within a Stage or App scope. If any plugin reports a violation, synthesis will be interrupted and the report displayed to the user.
- Parameters:
plugins- the validation plugins to add. This parameter is required.
-
addWarning
Adds a warning metadata entry to this construct that can be acknowledged.The CLI will display the warning when an app is synthesized, or fail if run in
--strictmode.The ID will be stored with the
annotationprefix (e.g.annotation::MyWarning). Use this prefixed ID when callingacknowledge()to suppress the warning.- Parameters:
id- unique identifier for the warning, used for acknowledgement. This parameter is required.message- the warning message. This parameter is required.
-