Debian Codegraph @

applyconfigurations/resource/v1beta1/basicdevice.go

raw
1 /*
2 Copyright The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 // Code generated by applyconfiguration-gen. DO NOT EDIT.
18
19 package v1beta1
20
21 import (
22 resourcev1beta1 "k8s.io/api/resource/v1beta1"
23 v1 "k8s.io/client-go/applyconfigurations/core/v1"
24 )
25
26 // BasicDeviceApplyConfiguration represents a declarative configuration of the BasicDevice type for use
27 // with apply.
28 type BasicDeviceApplyConfiguration struct {
29 Attributes map[resourcev1beta1.QualifiedName]DeviceAttributeApplyConfiguration `json:"attributes,omitempty"`
30 Capacity map[resourcev1beta1.QualifiedName]DeviceCapacityApplyConfiguration `json:"capacity,omitempty"`
31 ConsumesCounters []DeviceCounterConsumptionApplyConfiguration `json:"consumesCounters,omitempty"`
32 NodeName *string `json:"nodeName,omitempty"`
33 NodeSelector *v1.NodeSelectorApplyConfiguration `json:"nodeSelector,omitempty"`
34 AllNodes *bool `json:"allNodes,omitempty"`
35 Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
36 }
37
38 // BasicDeviceApplyConfiguration constructs a declarative configuration of the BasicDevice type for use with
39 // apply.
40 func BasicDevice() *BasicDeviceApplyConfiguration {
41 return &BasicDeviceApplyConfiguration{}
42 }
43
44 // WithAttributes puts the entries into the Attributes field in the declarative configuration
45 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
46 // If called multiple times, the entries provided by each call will be put on the Attributes field,
47 // overwriting an existing map entries in Attributes field with the same key.
48 func (b *BasicDeviceApplyConfiguration) WithAttributes(entries map[resourcev1beta1.QualifiedName]DeviceAttributeApplyConfiguration) *BasicDeviceApplyConfiguration {
49 if b.Attributes == nil && len(entries) > 0 {
50 b.Attributes = make(map[resourcev1beta1.QualifiedName]DeviceAttributeApplyConfiguration, len(entries))
51 }
52 for k, v := range entries {
53 b.Attributes[k] = v
54 }
55 return b
56 }
57
58 // WithCapacity puts the entries into the Capacity field in the declarative configuration
59 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
60 // If called multiple times, the entries provided by each call will be put on the Capacity field,
61 // overwriting an existing map entries in Capacity field with the same key.
62 func (b *BasicDeviceApplyConfiguration) WithCapacity(entries map[resourcev1beta1.QualifiedName]DeviceCapacityApplyConfiguration) *BasicDeviceApplyConfiguration {
63 if b.Capacity == nil && len(entries) > 0 {
64 b.Capacity = make(map[resourcev1beta1.QualifiedName]DeviceCapacityApplyConfiguration, len(entries))
65 }
66 for k, v := range entries {
67 b.Capacity[k] = v
68 }
69 return b
70 }
71
72 // WithConsumesCounters adds the given value to the ConsumesCounters field in the declarative configuration
73 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
74 // If called multiple times, values provided by each call will be appended to the ConsumesCounters field.
75 func (b *BasicDeviceApplyConfiguration) WithConsumesCounters(values ...*DeviceCounterConsumptionApplyConfiguration) *BasicDeviceApplyConfiguration {
76 for i := range values {
77 if values[i] == nil {
78 panic("nil value passed to WithConsumesCounters")
79 }
80 b.ConsumesCounters = append(b.ConsumesCounters, *values[i])
81 }
82 return b
83 }
84
85 // WithNodeName sets the NodeName field in the declarative configuration to the given value
86 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
87 // If called multiple times, the NodeName field is set to the value of the last call.
88 func (b *BasicDeviceApplyConfiguration) WithNodeName(value string) *BasicDeviceApplyConfiguration {
89 b.NodeName = &value
90 return b
91 }
92
93 // WithNodeSelector sets the NodeSelector field in the declarative configuration to the given value
94 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
95 // If called multiple times, the NodeSelector field is set to the value of the last call.
96 func (b *BasicDeviceApplyConfiguration) WithNodeSelector(value *v1.NodeSelectorApplyConfiguration) *BasicDeviceApplyConfiguration {
97 b.NodeSelector = value
98 return b
99 }
100
101 // WithAllNodes sets the AllNodes field in the declarative configuration to the given value
102 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
103 // If called multiple times, the AllNodes field is set to the value of the last call.
104 func (b *BasicDeviceApplyConfiguration) WithAllNodes(value bool) *BasicDeviceApplyConfiguration {
105 b.AllNodes = &value
106 return b
107 }
108
109 // WithTaints adds the given value to the Taints field in the declarative configuration
110 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
111 // If called multiple times, values provided by each call will be appended to the Taints field.
112 func (b *BasicDeviceApplyConfiguration) WithTaints(values ...*DeviceTaintApplyConfiguration) *BasicDeviceApplyConfiguration {
113 for i := range values {
114 if values[i] == nil {
115 panic("nil value passed to WithTaints")
116 }
117 b.Taints = append(b.Taints, *values[i])
118 }
119 return b
120 }