// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1

// TokenUserValidationRuleApplyConfiguration represents a declarative configuration of the TokenUserValidationRule type for use
// with apply.
//
// TokenUserValidationRule provides a CEL-based rule used to validate a token subject.
// Each rule contains a CEL expression that is evaluated against the token’s claims.
type TokenUserValidationRuleApplyConfiguration struct {
	// expression is a required CEL expression that performs a validation on cluster user identity attributes like username, groups, etc.
	//
	// The expression must evaluate to a boolean value.
	// When the expression evaluates to 'true', the cluster user identity is considered valid.
	// When the expression evaluates to 'false', the cluster user identity is not considered valid.
	// expression must be at least 1 character in length and must not exceed 1024 characters.
	Expression *string `json:"expression,omitempty"`
	// message is a required human-readable message to be logged by the Kubernetes API server if the CEL expression defined in 'expression' fails.
	// message must be at least 1 character in length and must not exceed 256 characters.
	Message *string `json:"message,omitempty"`
}

// TokenUserValidationRuleApplyConfiguration constructs a declarative configuration of the TokenUserValidationRule type for use with
// apply.
func TokenUserValidationRule() *TokenUserValidationRuleApplyConfiguration {
	return &TokenUserValidationRuleApplyConfiguration{}
}

// WithExpression sets the Expression field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Expression field is set to the value of the last call.
func (b *TokenUserValidationRuleApplyConfiguration) WithExpression(value string) *TokenUserValidationRuleApplyConfiguration {
	b.Expression = &value
	return b
}

// WithMessage sets the Message field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Message field is set to the value of the last call.
func (b *TokenUserValidationRuleApplyConfiguration) WithMessage(value string) *TokenUserValidationRuleApplyConfiguration {
	b.Message = &value
	return b
}
