io.github.cdklabs.cdknag.NagPackProps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdknag Show documentation
Show all versions of cdknag Show documentation
Check CDK v2 applications for best practices using a combination on available rule packs.
package io.github.cdklabs.cdknag;
/**
* Interface for creating a NagPack.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-08-22T00:13:27.174Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdknag.$Module.class, fqn = "cdk-nag.NagPackProps")
@software.amazon.jsii.Jsii.Proxy(NagPackProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface NagPackProps extends software.amazon.jsii.JsiiSerializable {
/**
* Additional NagLoggers for logging rule validation outputs.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getAdditionalLoggers() {
return null;
}
/**
* Whether or not to log suppressed rule violations as informational messages (default: false).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getLogIgnores() {
return null;
}
/**
* If reports are enabled, the output formats of compliance reports in the App's output directory (default: only CSV).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getReportFormats() {
return null;
}
/**
* Whether or not to generate compliance reports for applied Stacks in the App's output directory (default: true).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getReports() {
return null;
}
/**
* Conditionally prevent rules from being suppressed (default: no user provided condition).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.cdknag.INagSuppressionIgnore getSuppressionIgnoreCondition() {
return null;
}
/**
* Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getVerbose() {
return null;
}
/**
* @return a {@link Builder} of {@link NagPackProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link NagPackProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.List additionalLoggers;
java.lang.Boolean logIgnores;
java.util.List reportFormats;
java.lang.Boolean reports;
io.github.cdklabs.cdknag.INagSuppressionIgnore suppressionIgnoreCondition;
java.lang.Boolean verbose;
/**
* Sets the value of {@link NagPackProps#getAdditionalLoggers}
* @param additionalLoggers Additional NagLoggers for logging rule validation outputs.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder additionalLoggers(java.util.List extends io.github.cdklabs.cdknag.INagLogger> additionalLoggers) {
this.additionalLoggers = (java.util.List)additionalLoggers;
return this;
}
/**
* Sets the value of {@link NagPackProps#getLogIgnores}
* @param logIgnores Whether or not to log suppressed rule violations as informational messages (default: false).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder logIgnores(java.lang.Boolean logIgnores) {
this.logIgnores = logIgnores;
return this;
}
/**
* Sets the value of {@link NagPackProps#getReportFormats}
* @param reportFormats If reports are enabled, the output formats of compliance reports in the App's output directory (default: only CSV).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder reportFormats(java.util.List extends io.github.cdklabs.cdknag.NagReportFormat> reportFormats) {
this.reportFormats = (java.util.List)reportFormats;
return this;
}
/**
* Sets the value of {@link NagPackProps#getReports}
* @param reports Whether or not to generate compliance reports for applied Stacks in the App's output directory (default: true).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder reports(java.lang.Boolean reports) {
this.reports = reports;
return this;
}
/**
* Sets the value of {@link NagPackProps#getSuppressionIgnoreCondition}
* @param suppressionIgnoreCondition Conditionally prevent rules from being suppressed (default: no user provided condition).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder suppressionIgnoreCondition(io.github.cdklabs.cdknag.INagSuppressionIgnore suppressionIgnoreCondition) {
this.suppressionIgnoreCondition = suppressionIgnoreCondition;
return this;
}
/**
* Sets the value of {@link NagPackProps#getVerbose}
* @param verbose Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder verbose(java.lang.Boolean verbose) {
this.verbose = verbose;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link NagPackProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public NagPackProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link NagPackProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements NagPackProps {
private final java.util.List additionalLoggers;
private final java.lang.Boolean logIgnores;
private final java.util.List reportFormats;
private final java.lang.Boolean reports;
private final io.github.cdklabs.cdknag.INagSuppressionIgnore suppressionIgnoreCondition;
private final java.lang.Boolean verbose;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.additionalLoggers = software.amazon.jsii.Kernel.get(this, "additionalLoggers", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdknag.INagLogger.class)));
this.logIgnores = software.amazon.jsii.Kernel.get(this, "logIgnores", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.reportFormats = software.amazon.jsii.Kernel.get(this, "reportFormats", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdknag.NagReportFormat.class)));
this.reports = software.amazon.jsii.Kernel.get(this, "reports", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.suppressionIgnoreCondition = software.amazon.jsii.Kernel.get(this, "suppressionIgnoreCondition", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdknag.INagSuppressionIgnore.class));
this.verbose = software.amazon.jsii.Kernel.get(this, "verbose", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.additionalLoggers = (java.util.List)builder.additionalLoggers;
this.logIgnores = builder.logIgnores;
this.reportFormats = (java.util.List)builder.reportFormats;
this.reports = builder.reports;
this.suppressionIgnoreCondition = builder.suppressionIgnoreCondition;
this.verbose = builder.verbose;
}
@Override
public final java.util.List getAdditionalLoggers() {
return this.additionalLoggers;
}
@Override
public final java.lang.Boolean getLogIgnores() {
return this.logIgnores;
}
@Override
public final java.util.List getReportFormats() {
return this.reportFormats;
}
@Override
public final java.lang.Boolean getReports() {
return this.reports;
}
@Override
public final io.github.cdklabs.cdknag.INagSuppressionIgnore getSuppressionIgnoreCondition() {
return this.suppressionIgnoreCondition;
}
@Override
public final java.lang.Boolean getVerbose() {
return this.verbose;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getAdditionalLoggers() != null) {
data.set("additionalLoggers", om.valueToTree(this.getAdditionalLoggers()));
}
if (this.getLogIgnores() != null) {
data.set("logIgnores", om.valueToTree(this.getLogIgnores()));
}
if (this.getReportFormats() != null) {
data.set("reportFormats", om.valueToTree(this.getReportFormats()));
}
if (this.getReports() != null) {
data.set("reports", om.valueToTree(this.getReports()));
}
if (this.getSuppressionIgnoreCondition() != null) {
data.set("suppressionIgnoreCondition", om.valueToTree(this.getSuppressionIgnoreCondition()));
}
if (this.getVerbose() != null) {
data.set("verbose", om.valueToTree(this.getVerbose()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk-nag.NagPackProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NagPackProps.Jsii$Proxy that = (NagPackProps.Jsii$Proxy) o;
if (this.additionalLoggers != null ? !this.additionalLoggers.equals(that.additionalLoggers) : that.additionalLoggers != null) return false;
if (this.logIgnores != null ? !this.logIgnores.equals(that.logIgnores) : that.logIgnores != null) return false;
if (this.reportFormats != null ? !this.reportFormats.equals(that.reportFormats) : that.reportFormats != null) return false;
if (this.reports != null ? !this.reports.equals(that.reports) : that.reports != null) return false;
if (this.suppressionIgnoreCondition != null ? !this.suppressionIgnoreCondition.equals(that.suppressionIgnoreCondition) : that.suppressionIgnoreCondition != null) return false;
return this.verbose != null ? this.verbose.equals(that.verbose) : that.verbose == null;
}
@Override
public final int hashCode() {
int result = this.additionalLoggers != null ? this.additionalLoggers.hashCode() : 0;
result = 31 * result + (this.logIgnores != null ? this.logIgnores.hashCode() : 0);
result = 31 * result + (this.reportFormats != null ? this.reportFormats.hashCode() : 0);
result = 31 * result + (this.reports != null ? this.reports.hashCode() : 0);
result = 31 * result + (this.suppressionIgnoreCondition != null ? this.suppressionIgnoreCondition.hashCode() : 0);
result = 31 * result + (this.verbose != null ? this.verbose.hashCode() : 0);
return result;
}
}
}