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

package v1alpha1

// RelabelConfigApplyConfiguration represents a declarative configuration of the RelabelConfig type for use
// with apply.
//
// RelabelConfig represents a relabeling rule.
type RelabelConfigApplyConfiguration struct {
	// name is a unique identifier for this relabel configuration.
	// Must contain only alphanumeric characters, hyphens, and underscores.
	// Must be between 1 and 63 characters in length.
	Name *string `json:"name,omitempty"`
	// sourceLabels specifies which label names to extract from each series for this relabeling rule.
	// The values of these labels are joined together using the configured separator,
	// and the resulting string is then matched against the regular expression.
	// If a referenced label does not exist on a series, Prometheus substitutes an empty string.
	// When omitted, the rule operates without extracting source labels (useful for actions like labelmap).
	// Minimum of 1 and maximum of 10 source labels can be specified, each between 1 and 128 characters.
	// Each entry must be unique.
	// Label names beginning with "__" (two underscores) are reserved for internal Prometheus use and are not allowed.
	// Label names SHOULD start with a letter (a-z, A-Z) or underscore (_), followed by zero or more letters, digits (0-9), or underscores for best compatibility.
	// While Prometheus supports UTF-8 characters in label names (since v3.0.0), using the recommended character set
	// ensures better compatibility with the wider ecosystem (tooling, third-party instrumentation, etc.).
	SourceLabels []string `json:"sourceLabels,omitempty"`
	// separator is the character sequence used to join source label values.
	// Common examples: ";", ",", "::", "|||".
	// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
	// The default value is ";".
	// Must be between 1 and 5 characters in length when specified.
	Separator *string `json:"separator,omitempty"`
	// regex is the regular expression to match against the concatenated source label values.
	// Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax).
	// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
	// The default value is "(.*)" to match everything.
	// Must be between 1 and 1000 characters in length when specified.
	Regex *string `json:"regex,omitempty"`
	// action defines the action to perform on the matched labels and its configuration.
	// Exactly one action-specific configuration must be specified based on the action type.
	Action *RelabelActionConfigApplyConfiguration `json:"action,omitempty"`
}

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

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

// WithSourceLabels adds the given value to the SourceLabels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the SourceLabels field.
func (b *RelabelConfigApplyConfiguration) WithSourceLabels(values ...string) *RelabelConfigApplyConfiguration {
	for i := range values {
		b.SourceLabels = append(b.SourceLabels, values[i])
	}
	return b
}

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

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

// WithAction sets the Action 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 Action field is set to the value of the last call.
func (b *RelabelConfigApplyConfiguration) WithAction(value *RelabelActionConfigApplyConfiguration) *RelabelConfigApplyConfiguration {
	b.Action = value
	return b
}
