All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cdk8s.plus31.k8s.ValidatingAdmissionPolicySpecV1Beta1 Maven / Gradle / Ivy

package org.cdk8s.plus31.k8s;

/**
 * ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.
 */
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T12:15:25.174Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus31.$Module.class, fqn = "cdk8s-plus-31.k8s.ValidatingAdmissionPolicySpecV1Beta1")
@software.amazon.jsii.Jsii.Proxy(ValidatingAdmissionPolicySpecV1Beta1.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface ValidatingAdmissionPolicySpecV1Beta1 extends software.amazon.jsii.JsiiSerializable {

    /**
     * auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request.
     * 

* validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.util.List getAuditAnnotations() { return null; } /** * failurePolicy defines how to handle failures for the admission policy. *

* Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings. *

* A policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource. *

* failurePolicy does not define how validations that evaluate to false are handled. *

* When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced. *

* Allowed values are Ignore or Fail. Defaults to Fail. *

* Default: Fail. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.lang.String getFailurePolicy() { return null; } /** * MatchConditions is a list of conditions that must be met for a request to be validated. *

* Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. *

* If a parameter object is provided, it can be accessed via the params handle in the same manner as validation expressions. *

* The exact matching logic is (in order): *

*

    *
  1. If ANY matchCondition evaluates to FALSE, the policy is skipped.
  2. *
  3. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
  4. *
  5. If any matchCondition evaluates to an error (but none are FALSE):
  6. *
*

*

    *
  • If failurePolicy=Fail, reject the request
  • *
  • If failurePolicy=Ignore, the policy is skipped
  • *
*/ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.util.List getMatchConditions() { return null; } /** * MatchConstraints specifies what resources this policy is designed to validate. *

* The AdmissionPolicy cares about a request if it matches all Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.k8s.MatchResourcesV1Beta1 getMatchConstraints() { return null; } /** * ParamKind specifies the kind of resources used to parameterize this policy. *

* If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable org.cdk8s.plus31.k8s.ParamKindV1Beta1 getParamKind() { return null; } /** * Validations contain CEL expressions which is used to apply the validation. *

* Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.util.List getValidations() { return null; } /** * Variables contain definitions of variables that can be used in composition of other expressions. *

* Each variable is defined as a named CEL expression. The variables defined here will be available under variables in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy. *

* The expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable java.util.List getVariables() { return null; } /** * @return a {@link Builder} of {@link ValidatingAdmissionPolicySpecV1Beta1} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) static Builder builder() { return new Builder(); } /** * A builder for {@link ValidatingAdmissionPolicySpecV1Beta1} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { java.util.List auditAnnotations; java.lang.String failurePolicy; java.util.List matchConditions; org.cdk8s.plus31.k8s.MatchResourcesV1Beta1 matchConstraints; org.cdk8s.plus31.k8s.ParamKindV1Beta1 paramKind; java.util.List validations; java.util.List variables; /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getAuditAnnotations} * @param auditAnnotations auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. * validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder auditAnnotations(java.util.List auditAnnotations) { this.auditAnnotations = (java.util.List)auditAnnotations; return this; } /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getFailurePolicy} * @param failurePolicy failurePolicy defines how to handle failures for the admission policy. * Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings. *

* A policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource. *

* failurePolicy does not define how validations that evaluate to false are handled. *

* When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced. *

* Allowed values are Ignore or Fail. Defaults to Fail. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder failurePolicy(java.lang.String failurePolicy) { this.failurePolicy = failurePolicy; return this; } /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getMatchConditions} * @param matchConditions MatchConditions is a list of conditions that must be met for a request to be validated. * Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. *

* If a parameter object is provided, it can be accessed via the params handle in the same manner as validation expressions. *

* The exact matching logic is (in order): *

*

    *
  1. If ANY matchCondition evaluates to FALSE, the policy is skipped.
  2. *
  3. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
  4. *
  5. If any matchCondition evaluates to an error (but none are FALSE):
  6. *
*

*

    *
  • If failurePolicy=Fail, reject the request
  • *
  • If failurePolicy=Ignore, the policy is skipped
  • *
* @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder matchConditions(java.util.List matchConditions) { this.matchConditions = (java.util.List)matchConditions; return this; } /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getMatchConstraints} * @param matchConstraints MatchConstraints specifies what resources this policy is designed to validate. * The AdmissionPolicy cares about a request if it matches all Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder matchConstraints(org.cdk8s.plus31.k8s.MatchResourcesV1Beta1 matchConstraints) { this.matchConstraints = matchConstraints; return this; } /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getParamKind} * @param paramKind ParamKind specifies the kind of resources used to parameterize this policy. * If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder paramKind(org.cdk8s.plus31.k8s.ParamKindV1Beta1 paramKind) { this.paramKind = paramKind; return this; } /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getValidations} * @param validations Validations contain CEL expressions which is used to apply the validation. * Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder validations(java.util.List validations) { this.validations = (java.util.List)validations; return this; } /** * Sets the value of {@link ValidatingAdmissionPolicySpecV1Beta1#getVariables} * @param variables Variables contain definitions of variables that can be used in composition of other expressions. * Each variable is defined as a named CEL expression. The variables defined here will be available under variables in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy. *

* The expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @SuppressWarnings("unchecked") public Builder variables(java.util.List variables) { this.variables = (java.util.List)variables; return this; } /** * Builds the configured instance. * @return a new instance of {@link ValidatingAdmissionPolicySpecV1Beta1} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public ValidatingAdmissionPolicySpecV1Beta1 build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link ValidatingAdmissionPolicySpecV1Beta1} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ValidatingAdmissionPolicySpecV1Beta1 { private final java.util.List auditAnnotations; private final java.lang.String failurePolicy; private final java.util.List matchConditions; private final org.cdk8s.plus31.k8s.MatchResourcesV1Beta1 matchConstraints; private final org.cdk8s.plus31.k8s.ParamKindV1Beta1 paramKind; private final java.util.List validations; private final java.util.List variables; /** * 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.auditAnnotations = software.amazon.jsii.Kernel.get(this, "auditAnnotations", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.AuditAnnotationV1Beta1.class))); this.failurePolicy = software.amazon.jsii.Kernel.get(this, "failurePolicy", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); this.matchConditions = software.amazon.jsii.Kernel.get(this, "matchConditions", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.MatchConditionV1Beta1.class))); this.matchConstraints = software.amazon.jsii.Kernel.get(this, "matchConstraints", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.MatchResourcesV1Beta1.class)); this.paramKind = software.amazon.jsii.Kernel.get(this, "paramKind", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.ParamKindV1Beta1.class)); this.validations = software.amazon.jsii.Kernel.get(this, "validations", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.ValidationV1Beta1.class))); this.variables = software.amazon.jsii.Kernel.get(this, "variables", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.k8s.VariableV1Beta1.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.auditAnnotations = (java.util.List)builder.auditAnnotations; this.failurePolicy = builder.failurePolicy; this.matchConditions = (java.util.List)builder.matchConditions; this.matchConstraints = builder.matchConstraints; this.paramKind = builder.paramKind; this.validations = (java.util.List)builder.validations; this.variables = (java.util.List)builder.variables; } @Override public final java.util.List getAuditAnnotations() { return this.auditAnnotations; } @Override public final java.lang.String getFailurePolicy() { return this.failurePolicy; } @Override public final java.util.List getMatchConditions() { return this.matchConditions; } @Override public final org.cdk8s.plus31.k8s.MatchResourcesV1Beta1 getMatchConstraints() { return this.matchConstraints; } @Override public final org.cdk8s.plus31.k8s.ParamKindV1Beta1 getParamKind() { return this.paramKind; } @Override public final java.util.List getValidations() { return this.validations; } @Override public final java.util.List getVariables() { return this.variables; } @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.getAuditAnnotations() != null) { data.set("auditAnnotations", om.valueToTree(this.getAuditAnnotations())); } if (this.getFailurePolicy() != null) { data.set("failurePolicy", om.valueToTree(this.getFailurePolicy())); } if (this.getMatchConditions() != null) { data.set("matchConditions", om.valueToTree(this.getMatchConditions())); } if (this.getMatchConstraints() != null) { data.set("matchConstraints", om.valueToTree(this.getMatchConstraints())); } if (this.getParamKind() != null) { data.set("paramKind", om.valueToTree(this.getParamKind())); } if (this.getValidations() != null) { data.set("validations", om.valueToTree(this.getValidations())); } if (this.getVariables() != null) { data.set("variables", om.valueToTree(this.getVariables())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("cdk8s-plus-31.k8s.ValidatingAdmissionPolicySpecV1Beta1")); 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; ValidatingAdmissionPolicySpecV1Beta1.Jsii$Proxy that = (ValidatingAdmissionPolicySpecV1Beta1.Jsii$Proxy) o; if (this.auditAnnotations != null ? !this.auditAnnotations.equals(that.auditAnnotations) : that.auditAnnotations != null) return false; if (this.failurePolicy != null ? !this.failurePolicy.equals(that.failurePolicy) : that.failurePolicy != null) return false; if (this.matchConditions != null ? !this.matchConditions.equals(that.matchConditions) : that.matchConditions != null) return false; if (this.matchConstraints != null ? !this.matchConstraints.equals(that.matchConstraints) : that.matchConstraints != null) return false; if (this.paramKind != null ? !this.paramKind.equals(that.paramKind) : that.paramKind != null) return false; if (this.validations != null ? !this.validations.equals(that.validations) : that.validations != null) return false; return this.variables != null ? this.variables.equals(that.variables) : that.variables == null; } @Override public final int hashCode() { int result = this.auditAnnotations != null ? this.auditAnnotations.hashCode() : 0; result = 31 * result + (this.failurePolicy != null ? this.failurePolicy.hashCode() : 0); result = 31 * result + (this.matchConditions != null ? this.matchConditions.hashCode() : 0); result = 31 * result + (this.matchConstraints != null ? this.matchConstraints.hashCode() : 0); result = 31 * result + (this.paramKind != null ? this.paramKind.hashCode() : 0); result = 31 * result + (this.validations != null ? this.validations.hashCode() : 0); result = 31 * result + (this.variables != null ? this.variables.hashCode() : 0); return result; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy