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

package v1alpha1

import (
	configv1alpha1 "github.com/openshift/api/config/v1alpha1"
	v1 "k8s.io/api/core/v1"
)

// AlertmanagerCustomConfigApplyConfiguration represents a declarative configuration of the AlertmanagerCustomConfig type for use
// with apply.
type AlertmanagerCustomConfigApplyConfiguration struct {
	LogLevel                  *configv1alpha1.LogLevel              `json:"logLevel,omitempty"`
	NodeSelector              map[string]string                     `json:"nodeSelector,omitempty"`
	Resources                 []ContainerResourceApplyConfiguration `json:"resources,omitempty"`
	Secrets                   []configv1alpha1.SecretName           `json:"secrets,omitempty"`
	Tolerations               []v1.Toleration                       `json:"tolerations,omitempty"`
	TopologySpreadConstraints []v1.TopologySpreadConstraint         `json:"topologySpreadConstraints,omitempty"`
	VolumeClaimTemplate       *v1.PersistentVolumeClaim             `json:"volumeClaimTemplate,omitempty"`
}

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

// WithLogLevel sets the LogLevel 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 LogLevel field is set to the value of the last call.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithLogLevel(value configv1alpha1.LogLevel) *AlertmanagerCustomConfigApplyConfiguration {
	b.LogLevel = &value
	return b
}

// WithNodeSelector puts the entries into the NodeSelector field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the NodeSelector field,
// overwriting an existing map entries in NodeSelector field with the same key.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithNodeSelector(entries map[string]string) *AlertmanagerCustomConfigApplyConfiguration {
	if b.NodeSelector == nil && len(entries) > 0 {
		b.NodeSelector = make(map[string]string, len(entries))
	}
	for k, v := range entries {
		b.NodeSelector[k] = v
	}
	return b
}

// WithResources adds the given value to the Resources 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 Resources field.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithResources(values ...*ContainerResourceApplyConfiguration) *AlertmanagerCustomConfigApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithResources")
		}
		b.Resources = append(b.Resources, *values[i])
	}
	return b
}

// WithSecrets adds the given value to the Secrets 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 Secrets field.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithSecrets(values ...configv1alpha1.SecretName) *AlertmanagerCustomConfigApplyConfiguration {
	for i := range values {
		b.Secrets = append(b.Secrets, values[i])
	}
	return b
}

// WithTolerations adds the given value to the Tolerations 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 Tolerations field.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithTolerations(values ...v1.Toleration) *AlertmanagerCustomConfigApplyConfiguration {
	for i := range values {
		b.Tolerations = append(b.Tolerations, values[i])
	}
	return b
}

// WithTopologySpreadConstraints adds the given value to the TopologySpreadConstraints 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 TopologySpreadConstraints field.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithTopologySpreadConstraints(values ...v1.TopologySpreadConstraint) *AlertmanagerCustomConfigApplyConfiguration {
	for i := range values {
		b.TopologySpreadConstraints = append(b.TopologySpreadConstraints, values[i])
	}
	return b
}

// WithVolumeClaimTemplate sets the VolumeClaimTemplate 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 VolumeClaimTemplate field is set to the value of the last call.
func (b *AlertmanagerCustomConfigApplyConfiguration) WithVolumeClaimTemplate(value v1.PersistentVolumeClaim) *AlertmanagerCustomConfigApplyConfiguration {
	b.VolumeClaimTemplate = &value
	return b
}
