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

package v1

// ExtraMappingApplyConfiguration represents a declarative configuration of the ExtraMapping type for use
// with apply.
//
// ExtraMapping allows specifying a key and CEL expression to evaluate the keys' value.
// It is used to create additional mappings and attributes added to a cluster identity from a provided authentication token.
type ExtraMappingApplyConfiguration struct {
	// key is a required field that specifies the string to use as the extra attribute key.
	//
	// key must be a domain-prefix path (e.g 'example.org/foo').
	// key must not exceed 510 characters in length.
	// key must contain the '/' character, separating the domain and path characters.
	// key must not be empty.
	//
	// The domain portion of the key (string of characters prior to the '/') must be a valid RFC1123 subdomain.
	// It must not exceed 253 characters in length.
	// It must start and end with an alphanumeric character.
	// It must only contain lower case alphanumeric characters and '-' or '.'.
	// It must not use the reserved domains, or be subdomains of, "kubernetes.io", "k8s.io", and "openshift.io".
	//
	// The path portion of the key (string of characters after the '/') must not be empty and must consist of at least one alphanumeric character, percent-encoded octets, '-', '.', '_', '~', '!', '$', '&', ”', '(', ')', '*', '+', ',', ';', '=', and ':'.
	// It must not exceed 256 characters in length.
	Key *string `json:"key,omitempty"`
	// valueExpression is a required field to specify the CEL expression to extract the extra attribute value from a JWT token's claims.
	// valueExpression must produce a string or string array value.
	// "", [], and null are treated as the extra mapping not being present.
	// Empty string values within an array are filtered out.
	//
	// CEL expressions have access to the token claims through a CEL variable, 'claims'.
	// 'claims' is a map of claim names to claim values.
	// For example, the 'sub' claim value can be accessed as 'claims.sub'.
	// Nested claims can be accessed using dot notation ('claims.foo.bar').
	//
	// valueExpression must not exceed 1024 characters in length.
	// valueExpression must not be empty.
	ValueExpression *string `json:"valueExpression,omitempty"`
}

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

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

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