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

com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.ValidatingAdmissionPolicySpecArgs Maven / Gradle / Ivy

There is a newer version: 4.19.0-alpha.1730750641
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs;

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import com.pulumi.exceptions.MissingRequiredPropertyException;
import com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.AuditAnnotationArgs;
import com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.MatchConditionArgs;
import com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.MatchResourcesArgs;
import com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.ParamKindArgs;
import com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.ValidationArgs;
import com.pulumi.kubernetes.admissionregistration.v1alpha1.inputs.VariableArgs;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;


/**
 * ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.
 * 
 */
public final class ValidatingAdmissionPolicySpecArgs extends com.pulumi.resources.ResourceArgs {

    public static final ValidatingAdmissionPolicySpecArgs Empty = new ValidatingAdmissionPolicySpecArgs();

    /**
     * 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.
     * 
     */
    @Import(name="auditAnnotations")
    private @Nullable Output> auditAnnotations;

    /**
     * @return 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.
     * 
     */
    public Optional>> auditAnnotations() {
        return Optional.ofNullable(this.auditAnnotations);
    }

    /**
     * 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.
     * 
     */
    @Import(name="failurePolicy")
    private @Nullable Output failurePolicy;

    /**
     * @return 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.
     * 
     */
    public Optional> failurePolicy() {
        return Optional.ofNullable(this.failurePolicy);
    }

    /**
     * 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. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
     *   3. If any matchCondition evaluates to an error (but none are FALSE):
     *      - If failurePolicy=Fail, reject the request
     *      - If failurePolicy=Ignore, the policy is skipped
     * 
     */
    @Import(name="matchConditions")
    private @Nullable Output> matchConditions;

    /**
     * @return 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. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
     *   3. If any matchCondition evaluates to an error (but none are FALSE):
     *      - If failurePolicy=Fail, reject the request
     *      - If failurePolicy=Ignore, the policy is skipped
     * 
     */
    public Optional>> matchConditions() {
        return Optional.ofNullable(this.matchConditions);
    }

    /**
     * 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.
     * 
     */
    @Import(name="matchConstraints")
    private @Nullable Output matchConstraints;

    /**
     * @return 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.
     * 
     */
    public Optional> matchConstraints() {
        return Optional.ofNullable(this.matchConstraints);
    }

    /**
     * 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.
     * 
     */
    @Import(name="paramKind")
    private @Nullable Output paramKind;

    /**
     * @return 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.
     * 
     */
    public Optional> paramKind() {
        return Optional.ofNullable(this.paramKind);
    }

    /**
     * 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.
     * 
     */
    @Import(name="validations", required=true)
    private Output> validations;

    /**
     * @return 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.
     * 
     */
    public Output> validations() {
        return this.validations;
    }

    /**
     * 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.
     * 
     */
    @Import(name="variables")
    private @Nullable Output> variables;

    /**
     * @return 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.
     * 
     */
    public Optional>> variables() {
        return Optional.ofNullable(this.variables);
    }

    private ValidatingAdmissionPolicySpecArgs() {}

    private ValidatingAdmissionPolicySpecArgs(ValidatingAdmissionPolicySpecArgs $) {
        this.auditAnnotations = $.auditAnnotations;
        this.failurePolicy = $.failurePolicy;
        this.matchConditions = $.matchConditions;
        this.matchConstraints = $.matchConstraints;
        this.paramKind = $.paramKind;
        this.validations = $.validations;
        this.variables = $.variables;
    }

    public static Builder builder() {
        return new Builder();
    }
    public static Builder builder(ValidatingAdmissionPolicySpecArgs defaults) {
        return new Builder(defaults);
    }

    public static final class Builder {
        private ValidatingAdmissionPolicySpecArgs $;

        public Builder() {
            $ = new ValidatingAdmissionPolicySpecArgs();
        }

        public Builder(ValidatingAdmissionPolicySpecArgs defaults) {
            $ = new ValidatingAdmissionPolicySpecArgs(Objects.requireNonNull(defaults));
        }

        /**
         * @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 builder
         * 
         */
        public Builder auditAnnotations(@Nullable Output> auditAnnotations) {
            $.auditAnnotations = auditAnnotations;
            return this;
        }

        /**
         * @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 builder
         * 
         */
        public Builder auditAnnotations(List auditAnnotations) {
            return auditAnnotations(Output.of(auditAnnotations));
        }

        /**
         * @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 builder
         * 
         */
        public Builder auditAnnotations(AuditAnnotationArgs... auditAnnotations) {
            return auditAnnotations(List.of(auditAnnotations));
        }

        /**
         * @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 builder
         * 
         */
        public Builder failurePolicy(@Nullable Output failurePolicy) {
            $.failurePolicy = failurePolicy;
            return this;
        }

        /**
         * @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 builder
         * 
         */
        public Builder failurePolicy(String failurePolicy) {
            return failurePolicy(Output.of(failurePolicy));
        }

        /**
         * @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. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
         *   3. If any matchCondition evaluates to an error (but none are FALSE):
         *      - If failurePolicy=Fail, reject the request
         *      - If failurePolicy=Ignore, the policy is skipped
         * 
         * @return builder
         * 
         */
        public Builder matchConditions(@Nullable Output> matchConditions) {
            $.matchConditions = matchConditions;
            return this;
        }

        /**
         * @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. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
         *   3. If any matchCondition evaluates to an error (but none are FALSE):
         *      - If failurePolicy=Fail, reject the request
         *      - If failurePolicy=Ignore, the policy is skipped
         * 
         * @return builder
         * 
         */
        public Builder matchConditions(List matchConditions) {
            return matchConditions(Output.of(matchConditions));
        }

        /**
         * @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. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
         *   3. If any matchCondition evaluates to an error (but none are FALSE):
         *      - If failurePolicy=Fail, reject the request
         *      - If failurePolicy=Ignore, the policy is skipped
         * 
         * @return builder
         * 
         */
        public Builder matchConditions(MatchConditionArgs... matchConditions) {
            return matchConditions(List.of(matchConditions));
        }

        /**
         * @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 builder
         * 
         */
        public Builder matchConstraints(@Nullable Output matchConstraints) {
            $.matchConstraints = matchConstraints;
            return this;
        }

        /**
         * @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 builder
         * 
         */
        public Builder matchConstraints(MatchResourcesArgs matchConstraints) {
            return matchConstraints(Output.of(matchConstraints));
        }

        /**
         * @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 builder
         * 
         */
        public Builder paramKind(@Nullable Output paramKind) {
            $.paramKind = paramKind;
            return this;
        }

        /**
         * @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 builder
         * 
         */
        public Builder paramKind(ParamKindArgs paramKind) {
            return paramKind(Output.of(paramKind));
        }

        /**
         * @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 builder
         * 
         */
        public Builder validations(Output> validations) {
            $.validations = validations;
            return this;
        }

        /**
         * @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 builder
         * 
         */
        public Builder validations(List validations) {
            return validations(Output.of(validations));
        }

        /**
         * @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 builder
         * 
         */
        public Builder validations(ValidationArgs... validations) {
            return validations(List.of(validations));
        }

        /**
         * @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 builder
         * 
         */
        public Builder variables(@Nullable Output> variables) {
            $.variables = variables;
            return this;
        }

        /**
         * @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 builder
         * 
         */
        public Builder variables(List variables) {
            return variables(Output.of(variables));
        }

        /**
         * @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 builder
         * 
         */
        public Builder variables(VariableArgs... variables) {
            return variables(List.of(variables));
        }

        public ValidatingAdmissionPolicySpecArgs build() {
            if ($.validations == null) {
                throw new MissingRequiredPropertyException("ValidatingAdmissionPolicySpecArgs", "validations");
            }
            return $;
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy