| 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 |
v1 "k8s.io/client-go/applyconfigurations/core/v1" |
| 23 |
) |
| 24 |
|
| 25 |
// ResourceSliceSpecApplyConfiguration represents a declarative configuration of the ResourceSliceSpec type for use |
| 26 |
// with apply. |
| 27 |
type ResourceSliceSpecApplyConfiguration struct { |
| 28 |
Driver *string `json:"driver,omitempty"` |
| 29 |
Pool *ResourcePoolApplyConfiguration `json:"pool,omitempty"` |
| 30 |
NodeName *string `json:"nodeName,omitempty"` |
| 31 |
NodeSelector *v1.NodeSelectorApplyConfiguration `json:"nodeSelector,omitempty"` |
| 32 |
AllNodes *bool `json:"allNodes,omitempty"` |
| 33 |
Devices []DeviceApplyConfiguration `json:"devices,omitempty"` |
| 34 |
PerDeviceNodeSelection *bool `json:"perDeviceNodeSelection,omitempty"` |
| 35 |
SharedCounters []CounterSetApplyConfiguration `json:"sharedCounters,omitempty"` |
| 36 |
} |
| 37 |
|
| 38 |
// ResourceSliceSpecApplyConfiguration constructs a declarative configuration of the ResourceSliceSpec type for use with |
| 39 |
// apply. |
| 40 |
func ResourceSliceSpec() *ResourceSliceSpecApplyConfiguration { |
| 41 |
return &ResourceSliceSpecApplyConfiguration{} |
| 42 |
} |
| 43 |
|
| 44 |
// WithDriver sets the Driver field in the declarative configuration to the given value |
| 45 |
// and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 46 |
// If called multiple times, the Driver field is set to the value of the last call. |
| 47 |
func (b *ResourceSliceSpecApplyConfiguration) WithDriver(value string) *ResourceSliceSpecApplyConfiguration { |
| 48 |
b.Driver = &value |
| 49 |
return b |
| 50 |
} |
| 51 |
|
| 52 |
// WithPool sets the Pool field in the declarative configuration to the given value |
| 53 |
// and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 54 |
// If called multiple times, the Pool field is set to the value of the last call. |
| 55 |
func (b *ResourceSliceSpecApplyConfiguration) WithPool(value *ResourcePoolApplyConfiguration) *ResourceSliceSpecApplyConfiguration { |
| 56 |
b.Pool = value |
| 57 |
return b |
| 58 |
} |
| 59 |
|
| 60 |
// WithNodeName sets the NodeName field in the declarative configuration to the given value |
| 61 |
// and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 62 |
// If called multiple times, the NodeName field is set to the value of the last call. |
| 63 |
func (b *ResourceSliceSpecApplyConfiguration) WithNodeName(value string) *ResourceSliceSpecApplyConfiguration { |
| 64 |
b.NodeName = &value |
| 65 |
return b |
| 66 |
} |
| 67 |
|
| 68 |
// WithNodeSelector sets the NodeSelector field in the declarative configuration to the given value |
| 69 |
// and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 70 |
// If called multiple times, the NodeSelector field is set to the value of the last call. |
| 71 |
func (b *ResourceSliceSpecApplyConfiguration) WithNodeSelector(value *v1.NodeSelectorApplyConfiguration) *ResourceSliceSpecApplyConfiguration { |
| 72 |
b.NodeSelector = value |
| 73 |
return b |
| 74 |
} |
| 75 |
|
| 76 |
// WithAllNodes sets the AllNodes field in the declarative configuration to the given value |
| 77 |
// and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 78 |
// If called multiple times, the AllNodes field is set to the value of the last call. |
| 79 |
func (b *ResourceSliceSpecApplyConfiguration) WithAllNodes(value bool) *ResourceSliceSpecApplyConfiguration { |
| 80 |
b.AllNodes = &value |
| 81 |
return b |
| 82 |
} |
| 83 |
|
| 84 |
// WithDevices adds the given value to the Devices field in the declarative configuration |
| 85 |
// and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 86 |
// If called multiple times, values provided by each call will be appended to the Devices field. |
| 87 |
func (b *ResourceSliceSpecApplyConfiguration) WithDevices(values ...*DeviceApplyConfiguration) *ResourceSliceSpecApplyConfiguration { |
| 88 |
for i := range values { |
| 89 |
if values[i] == nil { |
| 90 |
panic("nil value passed to WithDevices") |
| 91 |
} |
| 92 |
b.Devices = append(b.Devices, *values[i]) |
| 93 |
} |
| 94 |
return b |
| 95 |
} |
| 96 |
|
| 97 |
// WithPerDeviceNodeSelection sets the PerDeviceNodeSelection field in the declarative configuration to the given value |
| 98 |
// and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 99 |
// If called multiple times, the PerDeviceNodeSelection field is set to the value of the last call. |
| 100 |
func (b *ResourceSliceSpecApplyConfiguration) WithPerDeviceNodeSelection(value bool) *ResourceSliceSpecApplyConfiguration { |
| 101 |
b.PerDeviceNodeSelection = &value |
| 102 |
return b |
| 103 |
} |
| 104 |
|
| 105 |
// WithSharedCounters adds the given value to the SharedCounters field in the declarative configuration |
| 106 |
// and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 107 |
// If called multiple times, values provided by each call will be appended to the SharedCounters field. |
| 108 |
func (b *ResourceSliceSpecApplyConfiguration) WithSharedCounters(values ...*CounterSetApplyConfiguration) *ResourceSliceSpecApplyConfiguration { |
| 109 |
for i := range values { |
| 110 |
if values[i] == nil { |
| 111 |
panic("nil value passed to WithSharedCounters") |
| 112 |
} |
| 113 |
b.SharedCounters = append(b.SharedCounters, *values[i]) |
| 114 |
} |
| 115 |
return b |
| 116 |
} |