/
aws_node_pool_builder.go
196 lines (177 loc) · 5.8 KB
/
aws_node_pool_builder.go
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.
package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1
// AWSNodePoolBuilder contains the data and logic needed to build 'AWS_node_pool' objects.
//
// Representation of aws node pool specific parameters.
type AWSNodePoolBuilder struct {
bitmap_ uint32
id string
href string
additionalSecurityGroupIds []string
availabilityZoneTypes map[string]string
instanceProfile string
instanceType string
subnetOutposts map[string]string
tags map[string]string
}
// NewAWSNodePool creates a new builder of 'AWS_node_pool' objects.
func NewAWSNodePool() *AWSNodePoolBuilder {
return &AWSNodePoolBuilder{}
}
// Link sets the flag that indicates if this is a link.
func (b *AWSNodePoolBuilder) Link(value bool) *AWSNodePoolBuilder {
b.bitmap_ |= 1
return b
}
// ID sets the identifier of the object.
func (b *AWSNodePoolBuilder) ID(value string) *AWSNodePoolBuilder {
b.id = value
b.bitmap_ |= 2
return b
}
// HREF sets the link to the object.
func (b *AWSNodePoolBuilder) HREF(value string) *AWSNodePoolBuilder {
b.href = value
b.bitmap_ |= 4
return b
}
// Empty returns true if the builder is empty, i.e. no attribute has a value.
func (b *AWSNodePoolBuilder) Empty() bool {
return b == nil || b.bitmap_&^1 == 0
}
// AdditionalSecurityGroupIds sets the value of the 'additional_security_group_ids' attribute to the given values.
func (b *AWSNodePoolBuilder) AdditionalSecurityGroupIds(values ...string) *AWSNodePoolBuilder {
b.additionalSecurityGroupIds = make([]string, len(values))
copy(b.additionalSecurityGroupIds, values)
b.bitmap_ |= 8
return b
}
// AvailabilityZoneTypes sets the value of the 'availability_zone_types' attribute to the given value.
func (b *AWSNodePoolBuilder) AvailabilityZoneTypes(value map[string]string) *AWSNodePoolBuilder {
b.availabilityZoneTypes = value
if value != nil {
b.bitmap_ |= 16
} else {
b.bitmap_ &^= 16
}
return b
}
// InstanceProfile sets the value of the 'instance_profile' attribute to the given value.
func (b *AWSNodePoolBuilder) InstanceProfile(value string) *AWSNodePoolBuilder {
b.instanceProfile = value
b.bitmap_ |= 32
return b
}
// InstanceType sets the value of the 'instance_type' attribute to the given value.
func (b *AWSNodePoolBuilder) InstanceType(value string) *AWSNodePoolBuilder {
b.instanceType = value
b.bitmap_ |= 64
return b
}
// SubnetOutposts sets the value of the 'subnet_outposts' attribute to the given value.
func (b *AWSNodePoolBuilder) SubnetOutposts(value map[string]string) *AWSNodePoolBuilder {
b.subnetOutposts = value
if value != nil {
b.bitmap_ |= 128
} else {
b.bitmap_ &^= 128
}
return b
}
// Tags sets the value of the 'tags' attribute to the given value.
func (b *AWSNodePoolBuilder) Tags(value map[string]string) *AWSNodePoolBuilder {
b.tags = value
if value != nil {
b.bitmap_ |= 256
} else {
b.bitmap_ &^= 256
}
return b
}
// Copy copies the attributes of the given object into this builder, discarding any previous values.
func (b *AWSNodePoolBuilder) Copy(object *AWSNodePool) *AWSNodePoolBuilder {
if object == nil {
return b
}
b.bitmap_ = object.bitmap_
b.id = object.id
b.href = object.href
if object.additionalSecurityGroupIds != nil {
b.additionalSecurityGroupIds = make([]string, len(object.additionalSecurityGroupIds))
copy(b.additionalSecurityGroupIds, object.additionalSecurityGroupIds)
} else {
b.additionalSecurityGroupIds = nil
}
if len(object.availabilityZoneTypes) > 0 {
b.availabilityZoneTypes = map[string]string{}
for k, v := range object.availabilityZoneTypes {
b.availabilityZoneTypes[k] = v
}
} else {
b.availabilityZoneTypes = nil
}
b.instanceProfile = object.instanceProfile
b.instanceType = object.instanceType
if len(object.subnetOutposts) > 0 {
b.subnetOutposts = map[string]string{}
for k, v := range object.subnetOutposts {
b.subnetOutposts[k] = v
}
} else {
b.subnetOutposts = nil
}
if len(object.tags) > 0 {
b.tags = map[string]string{}
for k, v := range object.tags {
b.tags[k] = v
}
} else {
b.tags = nil
}
return b
}
// Build creates a 'AWS_node_pool' object using the configuration stored in the builder.
func (b *AWSNodePoolBuilder) Build() (object *AWSNodePool, err error) {
object = new(AWSNodePool)
object.id = b.id
object.href = b.href
object.bitmap_ = b.bitmap_
if b.additionalSecurityGroupIds != nil {
object.additionalSecurityGroupIds = make([]string, len(b.additionalSecurityGroupIds))
copy(object.additionalSecurityGroupIds, b.additionalSecurityGroupIds)
}
if b.availabilityZoneTypes != nil {
object.availabilityZoneTypes = make(map[string]string)
for k, v := range b.availabilityZoneTypes {
object.availabilityZoneTypes[k] = v
}
}
object.instanceProfile = b.instanceProfile
object.instanceType = b.instanceType
if b.subnetOutposts != nil {
object.subnetOutposts = make(map[string]string)
for k, v := range b.subnetOutposts {
object.subnetOutposts[k] = v
}
}
if b.tags != nil {
object.tags = make(map[string]string)
for k, v := range b.tags {
object.tags[k] = v
}
}
return
}