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

package v1

// TokenClaimMappingApplyConfiguration represents a declarative configuration of the TokenClaimMapping type for use
// with apply.
//
// TokenClaimMapping allows specifying a JWT token claim to be used when mapping claims from an authentication token to cluster identities.
type TokenClaimMappingApplyConfiguration struct {
	// claim is an optional field for specifying the JWT token claim that is used in the mapping.
	// The value of this claim will be assigned to the field in which this mapping is associated.
	// claim must not exceed 256 characters in length.
	// When set to the empty string `""`, this means that no named claim should be used for the group mapping.
	// claim is required when the ExternalOIDCWithUpstreamParity feature gate is not enabled.
	Claim *string `json:"claim,omitempty"`
	// expression is an optional CEL expression used to derive
	// group values from JWT claims.
	//
	// CEL expressions have access to the token claims through a CEL variable, 'claims'.
	//
	// expression must be at least 1 character and must not exceed 1024 characters in length .
	//
	// When specified, claim must not be set or be explicitly set to the empty string (`""`).
	Expression *string `json:"expression,omitempty"`
}

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

// WithClaim sets the Claim 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 Claim field is set to the value of the last call.
func (b *TokenClaimMappingApplyConfiguration) WithClaim(value string) *TokenClaimMappingApplyConfiguration {
	b.Claim = &value
	return b
}

// 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 *TokenClaimMappingApplyConfiguration) WithExpression(value string) *TokenClaimMappingApplyConfiguration {
	b.Expression = &value
	return b
}
