-
Notifications
You must be signed in to change notification settings - Fork 122
/
handoff_type.go
354 lines (311 loc) · 8.82 KB
/
handoff_type.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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
/*
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/webrca/v1
import (
time "time"
)
// HandoffKind is the name of the type used to represent objects
// of type 'handoff'.
const HandoffKind = "Handoff"
// HandoffLinkKind is the name of the type used to represent links
// to objects of type 'handoff'.
const HandoffLinkKind = "HandoffLink"
// HandoffNilKind is the name of the type used to nil references
// to objects of type 'handoff'.
const HandoffNilKind = "HandoffNil"
// Handoff represents the values of the 'handoff' type.
//
// Definition of a Web RCA handoff.
type Handoff struct {
bitmap_ uint32
id string
href string
createdAt time.Time
deletedAt time.Time
handoffFrom *User
handoffTo *User
handoffType string
updatedAt time.Time
}
// Kind returns the name of the type of the object.
func (o *Handoff) Kind() string {
if o == nil {
return HandoffNilKind
}
if o.bitmap_&1 != 0 {
return HandoffLinkKind
}
return HandoffKind
}
// Link returns true iif this is a link.
func (o *Handoff) Link() bool {
return o != nil && o.bitmap_&1 != 0
}
// ID returns the identifier of the object.
func (o *Handoff) ID() string {
if o != nil && o.bitmap_&2 != 0 {
return o.id
}
return ""
}
// GetID returns the identifier of the object and a flag indicating if the
// identifier has a value.
func (o *Handoff) GetID() (value string, ok bool) {
ok = o != nil && o.bitmap_&2 != 0
if ok {
value = o.id
}
return
}
// HREF returns the link to the object.
func (o *Handoff) HREF() string {
if o != nil && o.bitmap_&4 != 0 {
return o.href
}
return ""
}
// GetHREF returns the link of the object and a flag indicating if the
// link has a value.
func (o *Handoff) GetHREF() (value string, ok bool) {
ok = o != nil && o.bitmap_&4 != 0
if ok {
value = o.href
}
return
}
// Empty returns true if the object is empty, i.e. no attribute has a value.
func (o *Handoff) Empty() bool {
return o == nil || o.bitmap_&^1 == 0
}
// CreatedAt returns the value of the 'created_at' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// Object creation timestamp.
func (o *Handoff) CreatedAt() time.Time {
if o != nil && o.bitmap_&8 != 0 {
return o.createdAt
}
return time.Time{}
}
// GetCreatedAt returns the value of the 'created_at' attribute and
// a flag indicating if the attribute has a value.
//
// Object creation timestamp.
func (o *Handoff) GetCreatedAt() (value time.Time, ok bool) {
ok = o != nil && o.bitmap_&8 != 0
if ok {
value = o.createdAt
}
return
}
// DeletedAt returns the value of the 'deleted_at' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// Object deletion timestamp.
func (o *Handoff) DeletedAt() time.Time {
if o != nil && o.bitmap_&16 != 0 {
return o.deletedAt
}
return time.Time{}
}
// GetDeletedAt returns the value of the 'deleted_at' attribute and
// a flag indicating if the attribute has a value.
//
// Object deletion timestamp.
func (o *Handoff) GetDeletedAt() (value time.Time, ok bool) {
ok = o != nil && o.bitmap_&16 != 0
if ok {
value = o.deletedAt
}
return
}
// HandoffFrom returns the value of the 'handoff_from' attribute, or
// the zero value of the type if the attribute doesn't have a value.
func (o *Handoff) HandoffFrom() *User {
if o != nil && o.bitmap_&32 != 0 {
return o.handoffFrom
}
return nil
}
// GetHandoffFrom returns the value of the 'handoff_from' attribute and
// a flag indicating if the attribute has a value.
func (o *Handoff) GetHandoffFrom() (value *User, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
if ok {
value = o.handoffFrom
}
return
}
// HandoffTo returns the value of the 'handoff_to' attribute, or
// the zero value of the type if the attribute doesn't have a value.
func (o *Handoff) HandoffTo() *User {
if o != nil && o.bitmap_&64 != 0 {
return o.handoffTo
}
return nil
}
// GetHandoffTo returns the value of the 'handoff_to' attribute and
// a flag indicating if the attribute has a value.
func (o *Handoff) GetHandoffTo() (value *User, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
if ok {
value = o.handoffTo
}
return
}
// HandoffType returns the value of the 'handoff_type' attribute, or
// the zero value of the type if the attribute doesn't have a value.
func (o *Handoff) HandoffType() string {
if o != nil && o.bitmap_&128 != 0 {
return o.handoffType
}
return ""
}
// GetHandoffType returns the value of the 'handoff_type' attribute and
// a flag indicating if the attribute has a value.
func (o *Handoff) GetHandoffType() (value string, ok bool) {
ok = o != nil && o.bitmap_&128 != 0
if ok {
value = o.handoffType
}
return
}
// UpdatedAt returns the value of the 'updated_at' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// Object modification timestamp.
func (o *Handoff) UpdatedAt() time.Time {
if o != nil && o.bitmap_&256 != 0 {
return o.updatedAt
}
return time.Time{}
}
// GetUpdatedAt returns the value of the 'updated_at' attribute and
// a flag indicating if the attribute has a value.
//
// Object modification timestamp.
func (o *Handoff) GetUpdatedAt() (value time.Time, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
if ok {
value = o.updatedAt
}
return
}
// HandoffListKind is the name of the type used to represent list of objects of
// type 'handoff'.
const HandoffListKind = "HandoffList"
// HandoffListLinkKind is the name of the type used to represent links to list
// of objects of type 'handoff'.
const HandoffListLinkKind = "HandoffListLink"
// HandoffNilKind is the name of the type used to nil lists of objects of
// type 'handoff'.
const HandoffListNilKind = "HandoffListNil"
// HandoffList is a list of values of the 'handoff' type.
type HandoffList struct {
href string
link bool
items []*Handoff
}
// Kind returns the name of the type of the object.
func (l *HandoffList) Kind() string {
if l == nil {
return HandoffListNilKind
}
if l.link {
return HandoffListLinkKind
}
return HandoffListKind
}
// Link returns true iif this is a link.
func (l *HandoffList) Link() bool {
return l != nil && l.link
}
// HREF returns the link to the list.
func (l *HandoffList) HREF() string {
if l != nil {
return l.href
}
return ""
}
// GetHREF returns the link of the list and a flag indicating if the
// link has a value.
func (l *HandoffList) GetHREF() (value string, ok bool) {
ok = l != nil && l.href != ""
if ok {
value = l.href
}
return
}
// Len returns the length of the list.
func (l *HandoffList) Len() int {
if l == nil {
return 0
}
return len(l.items)
}
// Empty returns true if the list is empty.
func (l *HandoffList) Empty() bool {
return l == nil || len(l.items) == 0
}
// Get returns the item of the list with the given index. If there is no item with
// that index it returns nil.
func (l *HandoffList) Get(i int) *Handoff {
if l == nil || i < 0 || i >= len(l.items) {
return nil
}
return l.items[i]
}
// Slice returns an slice containing the items of the list. The returned slice is a
// copy of the one used internally, so it can be modified without affecting the
// internal representation.
//
// If you don't need to modify the returned slice consider using the Each or Range
// functions, as they don't need to allocate a new slice.
func (l *HandoffList) Slice() []*Handoff {
var slice []*Handoff
if l == nil {
slice = make([]*Handoff, 0)
} else {
slice = make([]*Handoff, len(l.items))
copy(slice, l.items)
}
return slice
}
// Each runs the given function for each item of the list, in order. If the function
// returns false the iteration stops, otherwise it continues till all the elements
// of the list have been processed.
func (l *HandoffList) Each(f func(item *Handoff) bool) {
if l == nil {
return
}
for _, item := range l.items {
if !f(item) {
break
}
}
}
// Range runs the given function for each index and item of the list, in order. If
// the function returns false the iteration stops, otherwise it continues till all
// the elements of the list have been processed.
func (l *HandoffList) Range(f func(index int, item *Handoff) bool) {
if l == nil {
return
}
for index, item := range l.items {
if !f(index, item) {
break
}
}
}