io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidator Maven / Gradle / Ivy
Show all versions of cdk-validator-cfnguard Show documentation
package io.github.cdklabs.cdkvalidatorcfnguard;
/**
* A validation plugin using CFN Guard.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-04T00:20:43.532Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkvalidatorcfnguard.$Module.class, fqn = "@cdklabs/cdk-validator-cfnguard.CfnGuardValidator")
public class CfnGuardValidator extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.IPolicyValidationPluginBeta1 {
protected CfnGuardValidator(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected CfnGuardValidator(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public CfnGuardValidator(final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidatorProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { props });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public CfnGuardValidator() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* The method that will be called by the CDK framework to perform validations.
*
* This is where the plugin will evaluate the CloudFormation
* templates for compliance and report and violations
*
* @param context This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.PolicyValidationPluginReportBeta1 validate(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.IPolicyValidationContextBeta1 context) {
return software.amazon.jsii.Kernel.call(this, "validate", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.PolicyValidationPluginReportBeta1.class), new Object[] { java.util.Objects.requireNonNull(context, "context is required") });
}
/**
* The name of the plugin that will be displayed in the validation report.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getName() {
return software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* The list of rule IDs that the plugin will evaluate.
*
* Used for analytics
* purposes.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.Nullable java.util.List getRuleIds() {
return java.util.Optional.ofNullable((java.util.List)(software.amazon.jsii.Kernel.get(this, "ruleIds", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class))))).map(java.util.Collections::unmodifiableList).orElse(null);
}
/**
* The version of the plugin, following the Semantic Versioning specification (see https://semver.org/). This version is used for analytics purposes, to measure the usage of different plugins and different versions. The value of this property should be kept in sync with the actual version of the software package. If the version is not provided or is not a valid semantic version, it will be reported as 0.0.0
.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.Nullable java.lang.String getVersion() {
return software.amazon.jsii.Kernel.get(this, "version", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* A fluent builder for {@link io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidator}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create() {
return new Builder();
}
private io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidatorProps.Builder props;
private Builder() {
}
/**
* Enable the default Control Tower Guard rules.
*
* Default: true
*
* @return {@code this}
* @param controlTowerRulesEnabled Enable the default Control Tower Guard rules. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder controlTowerRulesEnabled(final java.lang.Boolean controlTowerRulesEnabled) {
this.props().controlTowerRulesEnabled(controlTowerRulesEnabled);
return this;
}
/**
* List of rule names to disable.
*
* Default: - no rules are disabled
*
* @return {@code this}
* @param disabledRules List of rule names to disable. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder disabledRules(final java.util.List disabledRules) {
this.props().disabledRules(disabledRules);
return this;
}
/**
* Local file paths to either a directory containing guard rules, or to an individual guard rule file.
*
* If the path is to a directory then the directory must
* only contain guard rule and the plugin will use
* all the rules in the directory
*
* Default: - no local rules will be used
*
* @return {@code this}
* @param rules Local file paths to either a directory containing guard rules, or to an individual guard rule file. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder rules(final java.util.List rules) {
this.props().rules(rules);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidator}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidator build() {
return new io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidator(
this.props != null ? this.props.build() : null
);
}
private io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidatorProps.Builder props() {
if (this.props == null) {
this.props = new io.github.cdklabs.cdkvalidatorcfnguard.CfnGuardValidatorProps.Builder();
}
return this.props;
}
}
}