Debian Codegraph @

applyconfigurations/resource/v1alpha3/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 v1alpha3
20
21 import (
22 resourcev1alpha3 "k8s.io/api/resource/v1alpha3"
23 resource "k8s.io/apimachinery/pkg/api/resource"
24 v1 "k8s.io/client-go/applyconfigurations/core/v1"
25 )
26
27 // BasicDeviceApplyConfiguration represents a declarative configuration of the BasicDevice type for use
28 // with apply.
29 type BasicDeviceApplyConfiguration struct {
30 Attributes map[resourcev1alpha3.QualifiedName]DeviceAttributeApplyConfiguration `json:"attributes,omitempty"`
31 Capacity map[resourcev1alpha3.QualifiedName]resource.Quantity `json:"capacity,omitempty"`
32 ConsumesCounters []DeviceCounterConsumptionApplyConfiguration `json:"consumesCounters,omitempty"`
33 NodeName *string `json:"nodeName,omitempty"`
34 NodeSelector *v1.NodeSelectorApplyConfiguration `json:"nodeSelector,omitempty"`
35 AllNodes *bool `json:"allNodes,omitempty"`
36 Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
37 }
38
39 // BasicDeviceApplyConfiguration constructs a declarative configuration of the BasicDevice type for use with
40 // apply.
41 func BasicDevice() *BasicDeviceApplyConfiguration {
42 return &BasicDeviceApplyConfiguration{}
43 }
44
45 // WithAttributes puts the entries into the Attributes field in the declarative configuration
46 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
47 // If called multiple times, the entries provided by each call will be put on the Attributes field,
48 // overwriting an existing map entries in Attributes field with the same key.
49 func (b *BasicDeviceApplyConfiguration) WithAttributes(entries map[resourcev1alpha3.QualifiedName]DeviceAttributeApplyConfiguration) *BasicDeviceApplyConfiguration {
50 if b.Attributes == nil && len(entries) > 0 {
51 b.Attributes = make(map[resourcev1alpha3.QualifiedName]DeviceAttributeApplyConfiguration, len(entries))
52 }
53 for k, v := range entries {
54 b.Attributes[k] = v
55 }
56 return b
57 }
58
59 // WithCapacity puts the entries into the Capacity field in the declarative configuration
60 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
61 // If called multiple times, the entries provided by each call will be put on the Capacity field,
62 // overwriting an existing map entries in Capacity field with the same key.
63 func (b *BasicDeviceApplyConfiguration) WithCapacity(entries map[resourcev1alpha3.QualifiedName]resource.Quantity) *BasicDeviceApplyConfiguration {
64 if b.Capacity == nil && len(entries) > 0 {
65 b.Capacity = make(map[resourcev1alpha3.QualifiedName]resource.Quantity, len(entries))
66 }
67 for k, v := range entries {
68 b.Capacity[k] = v
69 }
70 return b
71 }
72
73 // WithConsumesCounters adds the given value to the ConsumesCounters field in the declarative configuration
74 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
75 // If called multiple times, values provided by each call will be appended to the ConsumesCounters field.
76 func (b *BasicDeviceApplyConfiguration) WithConsumesCounters(values ...*DeviceCounterConsumptionApplyConfiguration) *BasicDeviceApplyConfiguration {
77 for i := range values {
78 if values[i] == nil {
79 panic("nil value passed to WithConsumesCounters")
80 }
81 b.ConsumesCounters = append(b.ConsumesCounters, *values[i])
82 }
83 return b
84 }
85
86 // WithNodeName sets the NodeName field in the declarative configuration to the given value
87 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
88 // If called multiple times, the NodeName field is set to the value of the last call.
89 func (b *BasicDeviceApplyConfiguration) WithNodeName(value string) *BasicDeviceApplyConfiguration {
90 b.NodeName = &value
91 return b
92 }
93
94 // WithNodeSelector sets the NodeSelector field in the declarative configuration to the given value
95 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
96 // If called multiple times, the NodeSelector field is set to the value of the last call.
97 func (b *BasicDeviceApplyConfiguration) WithNodeSelector(value *v1.NodeSelectorApplyConfiguration) *BasicDeviceApplyConfiguration {
98 b.NodeSelector = value
99 return b
100 }
101
102 // WithAllNodes sets the AllNodes field in the declarative configuration to the given value
103 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
104 // If called multiple times, the AllNodes field is set to the value of the last call.
105 func (b *BasicDeviceApplyConfiguration) WithAllNodes(value bool) *BasicDeviceApplyConfiguration {
106 b.AllNodes = &value
107 return b
108 }
109
110 // WithTaints adds the given value to the Taints field in the declarative configuration
111 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
112 // If called multiple times, values provided by each call will be appended to the Taints field.
113 func (b *BasicDeviceApplyConfiguration) WithTaints(values ...*DeviceTaintApplyConfiguration) *BasicDeviceApplyConfiguration {
114 for i := range values {
115 if values[i] == nil {
116 panic("nil value passed to WithTaints")
117 }
118 b.Taints = append(b.Taints, *values[i])
119 }
120 return b
121 }