1/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by applyconfiguration-gen. DO NOT EDIT.
18
19package v1
20
21// LabelSelectorApplyConfiguration represents an declarative configuration of the LabelSelector type for use
22// with apply.
23type LabelSelectorApplyConfiguration struct {
24	MatchLabels      map[string]string                            `json:"matchLabels,omitempty"`
25	MatchExpressions []LabelSelectorRequirementApplyConfiguration `json:"matchExpressions,omitempty"`
26}
27
28// LabelSelectorApplyConfiguration constructs an declarative configuration of the LabelSelector type for use with
29// apply.
30func LabelSelector() *LabelSelectorApplyConfiguration {
31	return &LabelSelectorApplyConfiguration{}
32}
33
34// WithMatchLabels puts the entries into the MatchLabels field in the declarative configuration
35// and returns the receiver, so that objects can be build by chaining "With" function invocations.
36// If called multiple times, the entries provided by each call will be put on the MatchLabels field,
37// overwriting an existing map entries in MatchLabels field with the same key.
38func (b *LabelSelectorApplyConfiguration) WithMatchLabels(entries map[string]string) *LabelSelectorApplyConfiguration {
39	if b.MatchLabels == nil && len(entries) > 0 {
40		b.MatchLabels = make(map[string]string, len(entries))
41	}
42	for k, v := range entries {
43		b.MatchLabels[k] = v
44	}
45	return b
46}
47
48// WithMatchExpressions adds the given value to the MatchExpressions field in the declarative configuration
49// and returns the receiver, so that objects can be build by chaining "With" function invocations.
50// If called multiple times, values provided by each call will be appended to the MatchExpressions field.
51func (b *LabelSelectorApplyConfiguration) WithMatchExpressions(values ...*LabelSelectorRequirementApplyConfiguration) *LabelSelectorApplyConfiguration {
52	for i := range values {
53		if values[i] == nil {
54			panic("nil value passed to WithMatchExpressions")
55		}
56		b.MatchExpressions = append(b.MatchExpressions, *values[i])
57	}
58	return b
59}
60