-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcell.go
More file actions
57 lines (50 loc) · 2.3 KB
/
cell.go
File metadata and controls
57 lines (50 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Code generated by controller-gen. DO NOT EDIT.
package v1
import (
resource "k8s.io/apimachinery/pkg/api/resource"
)
// CellApplyConfiguration represents a declarative configuration of the Cell type for use
// with apply.
type CellApplyConfiguration struct {
CellID *uint64 `json:"cellID,omitempty"`
Allocation map[string]resource.Quantity `json:"allocation,omitempty"`
Capacity map[string]resource.Quantity `json:"capacity,omitempty"`
}
// CellApplyConfiguration constructs a declarative configuration of the Cell type for use with
// apply.
func Cell() *CellApplyConfiguration {
return &CellApplyConfiguration{}
}
// WithCellID sets the CellID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CellID field is set to the value of the last call.
func (b *CellApplyConfiguration) WithCellID(value uint64) *CellApplyConfiguration {
b.CellID = &value
return b
}
// WithAllocation puts the entries into the Allocation field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Allocation field,
// overwriting an existing map entries in Allocation field with the same key.
func (b *CellApplyConfiguration) WithAllocation(entries map[string]resource.Quantity) *CellApplyConfiguration {
if b.Allocation == nil && len(entries) > 0 {
b.Allocation = make(map[string]resource.Quantity, len(entries))
}
for k, v := range entries {
b.Allocation[k] = v
}
return b
}
// WithCapacity puts the entries into the Capacity field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Capacity field,
// overwriting an existing map entries in Capacity field with the same key.
func (b *CellApplyConfiguration) WithCapacity(entries map[string]resource.Quantity) *CellApplyConfiguration {
if b.Capacity == nil && len(entries) > 0 {
b.Capacity = make(map[string]resource.Quantity, len(entries))
}
for k, v := range entries {
b.Capacity[k] = v
}
return b
}