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

package v1

import (
	metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
)

// UserRestrictionApplyConfiguration represents a declarative configuration of the UserRestriction type for use
// with apply.
//
// UserRestriction matches a user either by a string match on the user name,
// a string match on the name of a group to which the user belongs, or a label
// selector applied to the user labels.
type UserRestrictionApplyConfiguration struct {
	// users specifies a list of literal user names.
	Users []string `json:"users,omitempty"`
	// groups specifies a list of literal group names.
	Groups []string `json:"groups,omitempty"`
	// Selectors specifies a list of label selectors over user labels.
	Selectors []metav1.LabelSelectorApplyConfiguration `json:"labels,omitempty"`
}

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

// WithUsers adds the given value to the Users 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 Users field.
func (b *UserRestrictionApplyConfiguration) WithUsers(values ...string) *UserRestrictionApplyConfiguration {
	for i := range values {
		b.Users = append(b.Users, values[i])
	}
	return b
}

// WithGroups adds the given value to the Groups 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 Groups field.
func (b *UserRestrictionApplyConfiguration) WithGroups(values ...string) *UserRestrictionApplyConfiguration {
	for i := range values {
		b.Groups = append(b.Groups, values[i])
	}
	return b
}

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