-
Notifications
You must be signed in to change notification settings - Fork 120
/
addon_installation_builder.go
290 lines (263 loc) · 8.25 KB
/
addon_installation_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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
/*
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/addonsmgmt/v1
import (
time "time"
)
// AddonInstallationBuilder contains the data and logic needed to build 'addon_installation' objects.
//
// Representation of addon installation
type AddonInstallationBuilder struct {
bitmap_ uint32
id string
href string
addon *AddonBuilder
addonVersion *AddonVersionBuilder
billing *AddonInstallationBillingBuilder
creationTimestamp time.Time
csvName string
deletedTimestamp time.Time
desiredVersion string
operatorVersion string
parameters *AddonInstallationParametersBuilder
state AddonInstallationState
stateDescription string
subscription *ObjectReferenceBuilder
updatedTimestamp time.Time
}
// NewAddonInstallation creates a new builder of 'addon_installation' objects.
func NewAddonInstallation() *AddonInstallationBuilder {
return &AddonInstallationBuilder{}
}
// Link sets the flag that indicates if this is a link.
func (b *AddonInstallationBuilder) Link(value bool) *AddonInstallationBuilder {
b.bitmap_ |= 1
return b
}
// ID sets the identifier of the object.
func (b *AddonInstallationBuilder) ID(value string) *AddonInstallationBuilder {
b.id = value
b.bitmap_ |= 2
return b
}
// HREF sets the link to the object.
func (b *AddonInstallationBuilder) HREF(value string) *AddonInstallationBuilder {
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 *AddonInstallationBuilder) Empty() bool {
return b == nil || b.bitmap_&^1 == 0
}
// Addon sets the value of the 'addon' attribute to the given value.
//
// Representation of an addon that can be installed in a cluster.
func (b *AddonInstallationBuilder) Addon(value *AddonBuilder) *AddonInstallationBuilder {
b.addon = value
if value != nil {
b.bitmap_ |= 8
} else {
b.bitmap_ &^= 8
}
return b
}
// AddonVersion sets the value of the 'addon_version' attribute to the given value.
//
// Representation of an addon version.
func (b *AddonInstallationBuilder) AddonVersion(value *AddonVersionBuilder) *AddonInstallationBuilder {
b.addonVersion = value
if value != nil {
b.bitmap_ |= 16
} else {
b.bitmap_ &^= 16
}
return b
}
// Billing sets the value of the 'billing' attribute to the given value.
//
// Representation of an add-on installation billing.
func (b *AddonInstallationBuilder) Billing(value *AddonInstallationBillingBuilder) *AddonInstallationBuilder {
b.billing = value
if value != nil {
b.bitmap_ |= 32
} else {
b.bitmap_ &^= 32
}
return b
}
// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value.
func (b *AddonInstallationBuilder) CreationTimestamp(value time.Time) *AddonInstallationBuilder {
b.creationTimestamp = value
b.bitmap_ |= 64
return b
}
// CsvName sets the value of the 'csv_name' attribute to the given value.
func (b *AddonInstallationBuilder) CsvName(value string) *AddonInstallationBuilder {
b.csvName = value
b.bitmap_ |= 128
return b
}
// DeletedTimestamp sets the value of the 'deleted_timestamp' attribute to the given value.
func (b *AddonInstallationBuilder) DeletedTimestamp(value time.Time) *AddonInstallationBuilder {
b.deletedTimestamp = value
b.bitmap_ |= 256
return b
}
// DesiredVersion sets the value of the 'desired_version' attribute to the given value.
func (b *AddonInstallationBuilder) DesiredVersion(value string) *AddonInstallationBuilder {
b.desiredVersion = value
b.bitmap_ |= 512
return b
}
// OperatorVersion sets the value of the 'operator_version' attribute to the given value.
func (b *AddonInstallationBuilder) OperatorVersion(value string) *AddonInstallationBuilder {
b.operatorVersion = value
b.bitmap_ |= 1024
return b
}
// Parameters sets the value of the 'parameters' attribute to the given value.
//
// representation of addon installation parameter
func (b *AddonInstallationBuilder) Parameters(value *AddonInstallationParametersBuilder) *AddonInstallationBuilder {
b.parameters = value
if value != nil {
b.bitmap_ |= 2048
} else {
b.bitmap_ &^= 2048
}
return b
}
// State sets the value of the 'state' attribute to the given value.
//
// representation of addon installation state
func (b *AddonInstallationBuilder) State(value AddonInstallationState) *AddonInstallationBuilder {
b.state = value
b.bitmap_ |= 4096
return b
}
// StateDescription sets the value of the 'state_description' attribute to the given value.
func (b *AddonInstallationBuilder) StateDescription(value string) *AddonInstallationBuilder {
b.stateDescription = value
b.bitmap_ |= 8192
return b
}
// Subscription sets the value of the 'subscription' attribute to the given value.
//
// representation of object reference/subscription
func (b *AddonInstallationBuilder) Subscription(value *ObjectReferenceBuilder) *AddonInstallationBuilder {
b.subscription = value
if value != nil {
b.bitmap_ |= 16384
} else {
b.bitmap_ &^= 16384
}
return b
}
// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value.
func (b *AddonInstallationBuilder) UpdatedTimestamp(value time.Time) *AddonInstallationBuilder {
b.updatedTimestamp = value
b.bitmap_ |= 32768
return b
}
// Copy copies the attributes of the given object into this builder, discarding any previous values.
func (b *AddonInstallationBuilder) Copy(object *AddonInstallation) *AddonInstallationBuilder {
if object == nil {
return b
}
b.bitmap_ = object.bitmap_
b.id = object.id
b.href = object.href
if object.addon != nil {
b.addon = NewAddon().Copy(object.addon)
} else {
b.addon = nil
}
if object.addonVersion != nil {
b.addonVersion = NewAddonVersion().Copy(object.addonVersion)
} else {
b.addonVersion = nil
}
if object.billing != nil {
b.billing = NewAddonInstallationBilling().Copy(object.billing)
} else {
b.billing = nil
}
b.creationTimestamp = object.creationTimestamp
b.csvName = object.csvName
b.deletedTimestamp = object.deletedTimestamp
b.desiredVersion = object.desiredVersion
b.operatorVersion = object.operatorVersion
if object.parameters != nil {
b.parameters = NewAddonInstallationParameters().Copy(object.parameters)
} else {
b.parameters = nil
}
b.state = object.state
b.stateDescription = object.stateDescription
if object.subscription != nil {
b.subscription = NewObjectReference().Copy(object.subscription)
} else {
b.subscription = nil
}
b.updatedTimestamp = object.updatedTimestamp
return b
}
// Build creates a 'addon_installation' object using the configuration stored in the builder.
func (b *AddonInstallationBuilder) Build() (object *AddonInstallation, err error) {
object = new(AddonInstallation)
object.id = b.id
object.href = b.href
object.bitmap_ = b.bitmap_
if b.addon != nil {
object.addon, err = b.addon.Build()
if err != nil {
return
}
}
if b.addonVersion != nil {
object.addonVersion, err = b.addonVersion.Build()
if err != nil {
return
}
}
if b.billing != nil {
object.billing, err = b.billing.Build()
if err != nil {
return
}
}
object.creationTimestamp = b.creationTimestamp
object.csvName = b.csvName
object.deletedTimestamp = b.deletedTimestamp
object.desiredVersion = b.desiredVersion
object.operatorVersion = b.operatorVersion
if b.parameters != nil {
object.parameters, err = b.parameters.Build()
if err != nil {
return
}
}
object.state = b.state
object.stateDescription = b.stateDescription
if b.subscription != nil {
object.subscription, err = b.subscription.Build()
if err != nil {
return
}
}
object.updatedTimestamp = b.updatedTimestamp
return
}