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