-
Notifications
You must be signed in to change notification settings - Fork 1
/
role_binding.pb.watcher.go
685 lines (611 loc) · 19.5 KB
/
role_binding.pb.watcher.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
// Code generated by protoc-gen-goten-access
// Resource: RoleBinding
// DO NOT EDIT!!!
package role_binding_access
import (
"context"
"errors"
"fmt"
"sync/atomic"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
gotenaccess "github.com/cloudwan/goten-sdk/runtime/access"
"github.com/cloudwan/goten-sdk/runtime/api/view"
"github.com/cloudwan/goten-sdk/runtime/api/watch_type"
gotenresource "github.com/cloudwan/goten-sdk/runtime/resource"
role_binding_client "github.com/cloudwan/edgelq-sdk/iam/client/v1alpha2/role_binding"
role_binding "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/role_binding"
)
// TODO: This watcher is for stateless watch type only de facto as of now.
// Ordering and multiple filters do not cooperate at all.
// We could:
// * Add Cursor as parameter to NewWatcher + page size to WatcherConfig
// * Add ResetCursor method to Watcher - only one page available at the time byt still dynamic
// * Merge many pages with sorting/pagination within watcher and forward aggregated changes.
// Watcher is higher level stateful watcher with dynamic + multi filter support.
type Watcher struct {
client role_binding_client.RoleBindingServiceClient
config *WatcherConfig
outputEvtChan chan WatcherEvent
iOutputEvtChan chan gotenaccess.WatcherEvent
queryWatcherStates map[int]*queryWatcherState
watcherEvtsChan chan *QueryWatcherEvent
filters []*WatcherFilterParams
filtersResetChan chan []*WatcherFilterParams
inSyncFlag int32
nextIdentifier int
watcherCtx context.Context
watcherCtxCancel context.CancelFunc
useIChan int32
}
type WatcherConfig struct {
*gotenaccess.WatcherConfigBase
// common params that must be shared across queries
WatchType watch_type.WatchType
View view.View
FieldMask *role_binding.RoleBinding_FieldMask
OrderBy *role_binding.OrderBy
ChunkSize int
}
type WatcherFilterParams struct {
Parent *role_binding.ParentReference
Filter *role_binding.Filter
}
func (p *WatcherFilterParams) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("%s.%s", p.Parent, p.Filter)
}
func (p *WatcherFilterParams) GetIFilter() gotenresource.Filter {
return p.Filter
}
func (p *WatcherFilterParams) GetIParentRef() gotenresource.Reference {
return p.Parent
}
type queryWatcherState struct {
cancel context.CancelFunc
watcher *QueryWatcher
inSync bool
cache map[role_binding.Name]*role_binding.RoleBinding
filter *WatcherFilterParams
inSnapshot bool
pendingSnapshot []*role_binding.RoleBindingChange
}
func NewWatcher(client role_binding_client.RoleBindingServiceClient, config *WatcherConfig, filters ...*WatcherFilterParams) *Watcher {
ctx, cancel := context.WithCancel(context.Background())
return &Watcher{
client: client,
config: config,
filters: filters,
outputEvtChan: make(chan WatcherEvent, config.WatcherEventBufferSize),
queryWatcherStates: map[int]*queryWatcherState{},
watcherEvtsChan: make(chan *QueryWatcherEvent, config.WatcherEventBufferSize),
filtersResetChan: make(chan []*WatcherFilterParams, 1),
watcherCtx: ctx,
watcherCtxCancel: cancel,
}
}
func (pw *Watcher) Events() <-chan WatcherEvent {
return pw.outputEvtChan
}
func (pw *Watcher) IEvents() <-chan gotenaccess.WatcherEvent {
if atomic.CompareAndSwapInt32(&pw.useIChan, 0, 1) {
pw.iOutputEvtChan = make(chan gotenaccess.WatcherEvent, pw.config.WatcherEventBufferSize)
go func() {
for {
select {
case <-pw.watcherCtx.Done():
case evt := <-pw.outputEvtChan:
select {
case <-pw.watcherCtx.Done():
case pw.iOutputEvtChan <- &evt:
}
}
}
}()
}
return pw.iOutputEvtChan
}
func (pw *Watcher) InSync() bool {
return atomic.LoadInt32(&pw.inSyncFlag) > 0
}
func (pw *Watcher) GetFilters() []*WatcherFilterParams {
copied := make([]*WatcherFilterParams, 0, len(pw.filters))
for _, query := range pw.filters {
cQuery := &WatcherFilterParams{}
if query.Parent != nil {
cQuery.Parent = &role_binding.ParentReference{}
*cQuery.Parent = *query.Parent
}
if query.Filter != nil {
strValue, _ := query.Filter.ProtoString()
cQuery.Filter = &role_binding.Filter{}
_ = cQuery.Filter.ParseProtoString(strValue)
}
copied = append(copied, cQuery)
}
return copied
}
func (pw *Watcher) GetIFilters() []gotenaccess.WatcherFilterParams {
filters := pw.GetFilters()
result := make([]gotenaccess.WatcherFilterParams, 0, len(filters))
for _, filter := range filters {
result = append(result, filter)
}
return result
}
func (pw *Watcher) ResetFilters(ctx context.Context, filters ...*WatcherFilterParams) error {
select {
case <-ctx.Done():
return ctx.Err()
case pw.filtersResetChan <- filters:
}
return nil
}
func (pw *Watcher) ResetIFilters(ctx context.Context, filters ...gotenaccess.WatcherFilterParams) error {
typedFilters := make([]*WatcherFilterParams, 0, len(filters))
for _, filter := range filters {
typedFilters = append(typedFilters, filter.(*WatcherFilterParams))
}
return pw.ResetFilters(ctx, typedFilters...)
}
func (pw *Watcher) Run(ctx context.Context) error {
log := ctxlogrus.Extract(ctx).
WithField("watcher", "roleBinding-watcher")
ctx = ctxlogrus.ToContext(ctx, log)
log.Debugf("Initializing initial queries")
pw.resetFilters(ctx, pw.filters)
log.Debugf("running")
defer func() {
close(pw.outputEvtChan)
pw.watcherCtxCancel()
}()
for {
select {
case newFilters := <-pw.filtersResetChan:
pw.resetFilters(ctx, newFilters)
case evt := <-pw.watcherEvtsChan:
if evt.LostSync {
pw.onQueryLostSync(ctx, evt)
} else if evt.CheckSize {
pw.onQueryVerifySnapshotSize(ctx, evt)
} else if evt.Reset {
pw.onQueryResetStateIndicator(evt)
} else {
pw.onQueryChanges(ctx, evt)
}
case <-ctx.Done():
log.Debugf("context done, reason: %s", ctx.Err())
if errors.Is(ctx.Err(), context.Canceled) {
return nil
} else {
return ctx.Err()
}
}
}
}
func (pw *Watcher) resetFilters(ctx context.Context, filters []*WatcherFilterParams) {
pw.filters = filters
filtersMap := map[string]*WatcherFilterParams{}
for _, filter := range filters {
filtersMap[filter.String()] = filter
}
// Eliminate existing queries from queriesMap, eliminate queries that should be stopped
for identifier, state := range pw.queryWatcherStates {
key := state.filter.String()
if _, exists := filtersMap[key]; !exists {
state.cancel()
delete(pw.queryWatcherStates, identifier)
} else {
delete(filtersMap, key)
}
}
// start new queries with new filters
for _, filter := range filtersMap {
wctx, cancel := context.WithCancel(ctx)
newWatcher := NewQueryWatcher(
pw.nextIdentifier,
pw.client,
&QueryWatcherParams{
Parent: filter.Parent,
Filter: filter.Filter,
View: pw.config.View,
FieldMask: pw.config.FieldMask,
OrderBy: pw.config.OrderBy,
ChunkSize: pw.config.ChunkSize,
WatchType: pw.config.WatchType,
RecoveryDeadline: pw.config.RecoveryDeadline,
RetryTimeout: pw.config.RetryTimeout,
},
pw.watcherEvtsChan)
pw.queryWatcherStates[pw.nextIdentifier] = &queryWatcherState{
cancel: cancel,
watcher: newWatcher,
cache: map[role_binding.Name]*role_binding.RoleBinding{},
filter: filter,
inSnapshot: true,
}
pw.nextIdentifier++
go func() {
_ = newWatcher.Run(wctx)
}()
}
// if all in sync (possible if queries were eliminated with ResetFilters call), send snapshot, otherwise
// communicate "lost sync"
if pw.allInSync() {
pw.processSnapshot(ctx)
} else if pw.inSyncFlag > 0 {
pw.processSyncLost(ctx)
}
}
func (pw *Watcher) onQueryLostSync(ctx context.Context, evt *QueryWatcherEvent) {
state := pw.queryWatcherStates[evt.Identifier]
if state == nil {
return
}
state.inSync = false
state.cache = map[role_binding.Name]*role_binding.RoleBinding{}
state.inSnapshot = true
if pw.inSyncFlag > 0 {
pw.processSyncLost(ctx)
}
}
func (pw *Watcher) onQueryVerifySnapshotSize(ctx context.Context, evt *QueryWatcherEvent) {
state := pw.queryWatcherStates[evt.Identifier]
if state == nil {
return
}
currentSize := state.computeSize(evt.Changes)
if currentSize != evt.SnapshotSize {
ctxlogrus.Extract(ctx).
Warnf("Detected mismatch in snapshot size for filter %s: expected %d, has %d",
state.filter, evt.SnapshotSize, currentSize)
state.cancel()
delete(pw.queryWatcherStates, evt.Identifier)
// refresh this particular watcher
wctx, cancel := context.WithCancel(ctx)
newWatcher := NewQueryWatcher(
pw.nextIdentifier,
pw.client,
&QueryWatcherParams{
Parent: state.filter.Parent,
Filter: state.filter.Filter,
View: pw.config.View,
FieldMask: pw.config.FieldMask,
OrderBy: pw.config.OrderBy,
ChunkSize: pw.config.ChunkSize,
WatchType: pw.config.WatchType,
RecoveryDeadline: pw.config.RecoveryDeadline,
RetryTimeout: pw.config.RetryTimeout,
},
pw.watcherEvtsChan)
pw.queryWatcherStates[pw.nextIdentifier] = &queryWatcherState{
cancel: cancel,
watcher: newWatcher,
cache: state.cache,
filter: state.filter,
inSnapshot: true,
inSync: state.inSync,
}
pw.nextIdentifier++
go func() {
_ = newWatcher.Run(wctx)
}()
}
}
func (pw *Watcher) onQueryResetStateIndicator(evt *QueryWatcherEvent) {
state := pw.queryWatcherStates[evt.Identifier]
if state == nil {
return
}
state.inSnapshot = true
state.pendingSnapshot = nil
}
func (pw *Watcher) onQueryChanges(ctx context.Context, evt *QueryWatcherEvent) {
var changes []*WatcherEventChange
state := pw.queryWatcherStates[evt.Identifier]
if state == nil {
return
}
// evt.InSync is set when snapshot is complete or for every incremental update
// Since Watcher is stateful, we will collect query snapshot data without processing
// till its complete.
if state.inSnapshot {
state.pendingSnapshot = append(state.pendingSnapshot, evt.Changes...)
if evt.InSync {
// processes snapshot for this query only
// changes however may be only a diff from previous known state
changes = state.processSnapshot()
}
} else {
changes = state.transform(evt.Changes)
}
if evt.InSync {
if !state.inSync {
state.inSync = true
if pw.allInSync() {
pw.processSnapshot(ctx)
return
}
} else if pw.inSyncFlag > 0 {
evt := &WatcherEvent{WatcherEventBase: gotenaccess.NewWatcherEventBase(false), Changes: changes}
pw.sendEvent(ctx, evt)
}
}
}
func (pw *Watcher) processSyncLost(ctx context.Context) {
ctxlogrus.Extract(ctx).Infof("Notifiying watcher-wide sync lost")
atomic.StoreInt32(&pw.inSyncFlag, 0)
evt := &WatcherEvent{WatcherEventBase: gotenaccess.NewWatcherEventBaseLostSync()}
pw.sendEvent(ctx, evt)
}
func (pw *Watcher) processSnapshot(ctx context.Context) {
ctxlogrus.Extract(ctx).Infof("Watcher in sync")
atomic.StoreInt32(&pw.inSyncFlag, 1)
snapshot := make([]*WatcherEventChange, 0)
for _, state := range pw.queryWatcherStates {
for _, item := range state.cache {
snapshot = append(snapshot, NewAddWatcherEventChange(item))
}
}
evt := &WatcherEvent{WatcherEventBase: gotenaccess.NewWatcherEventBase(true), Changes: snapshot}
pw.sendEvent(ctx, evt)
}
func (pw *Watcher) allInSync() bool {
for _, state := range pw.queryWatcherStates {
if !state.inSync {
return false
}
}
return true
}
func (pw *Watcher) sendEvent(ctx context.Context, evt *WatcherEvent) {
select {
case <-ctx.Done():
case pw.outputEvtChan <- *evt:
}
}
type WatcherEventChange struct {
pre, post *role_binding.RoleBinding
name *role_binding.Name
}
func NewAddWatcherEventChange(resource *role_binding.RoleBinding) *WatcherEventChange {
return &WatcherEventChange{
post: resource,
name: resource.GetName(),
}
}
func NewModifyWatcherEventChange(current, previous *role_binding.RoleBinding) *WatcherEventChange {
return &WatcherEventChange{
pre: previous,
post: current,
name: current.GetName(),
}
}
func NewDeleteWatcherEventChange(deleted *role_binding.RoleBinding) *WatcherEventChange {
return &WatcherEventChange{
pre: deleted,
name: deleted.GetName(),
}
}
func (c *WatcherEventChange) GetName() *role_binding.Name {
return c.name
}
func (c *WatcherEventChange) GetRawName() gotenresource.Name {
return c.name
}
func (c *WatcherEventChange) IsAdd() bool {
return c.pre == nil && c.post != nil
}
func (c *WatcherEventChange) IsModify() bool {
return c.pre != nil && c.post != nil
}
func (c *WatcherEventChange) IsDelete() bool {
return c.pre != nil && c.post == nil
}
func (c *WatcherEventChange) GetAdded() *role_binding.RoleBinding {
if c.IsAdd() {
return c.post
}
return nil
}
func (c *WatcherEventChange) GetDeleted() *role_binding.RoleBinding {
if c.IsDelete() {
return c.pre
}
return nil
}
func (c *WatcherEventChange) GetPrevious() *role_binding.RoleBinding {
if c.IsModify() {
return c.pre
}
return nil
}
func (c *WatcherEventChange) GetCurrent() *role_binding.RoleBinding {
if c.IsAdd() || c.IsModify() {
return c.post
}
return nil
}
func (c *WatcherEventChange) GetRawAdded() gotenresource.Resource {
return c.GetAdded()
}
func (c *WatcherEventChange) GetRawDeleted() gotenresource.Resource {
return c.GetDeleted()
}
func (c *WatcherEventChange) GetRawPrevious() gotenresource.Resource {
return c.GetPrevious()
}
func (c *WatcherEventChange) GetRawCurrent() gotenresource.Resource {
return c.GetCurrent()
}
type WatcherEvent struct {
gotenaccess.WatcherEventBase
Changes []*WatcherEventChange
}
func (e *WatcherEvent) GetAt(index int) *WatcherEventChange {
if e == nil || len(e.Changes) <= index {
return nil
}
return e.Changes[index]
}
func (e *WatcherEvent) GetRawAt(index int) gotenaccess.WatcherEventChange {
return e.GetAt(index)
}
func (e *WatcherEvent) Length() int {
if e == nil {
return 0
}
return len(e.Changes)
}
func (e *WatcherEvent) AppendChange(change *WatcherEventChange) {
e.Changes = append(e.Changes, change)
}
func (e *WatcherEvent) AppendRawChange(change gotenaccess.WatcherEventChange) {
e.Changes = append(e.Changes, change.(*WatcherEventChange))
}
// Merge makes a shallow merge of two events
func (e *WatcherEvent) Merge(src *WatcherEvent) {
if src == nil {
return
}
if src.LostSync() || src.Resync() {
e.WatcherEventBase = src.WatcherEventBase
e.Changes = src.Changes
return
}
if !e.WatcherEventBase.Resync() {
e.WatcherEventBase = src.WatcherEventBase
e.Changes = append(e.Changes, src.Changes...)
return
}
// merge non-resync into resync
byName := make(map[role_binding.Name]*role_binding.RoleBinding, len(src.Changes)+len(e.Changes))
for _, currentChange := range e.Changes {
roleBinding := currentChange.GetCurrent()
byName[*roleBinding.GetName()] = roleBinding
}
for _, change := range src.Changes {
if change.IsDelete() {
delete(byName, *change.GetName())
} else {
roleBinding := change.GetCurrent()
byName[*roleBinding.GetName()] = roleBinding
}
}
e.Changes = make([]*WatcherEventChange, 0, len(byName))
for _, roleBinding := range byName {
e.Changes = append(e.Changes, NewAddWatcherEventChange(roleBinding))
}
}
func (qws *queryWatcherState) processSnapshot() []*WatcherEventChange {
watcherEventChanges := make([]*WatcherEventChange, 0, len(qws.pendingSnapshot))
prevCache := qws.cache
qws.cache = map[role_binding.Name]*role_binding.RoleBinding{}
for _, change := range qws.pendingSnapshot {
var currentItem *role_binding.RoleBinding
switch item := change.ChangeType.(type) {
case *role_binding.RoleBindingChange_Added_:
currentItem = item.Added.GetRoleBinding()
case *role_binding.RoleBindingChange_Current_:
currentItem = item.Current.GetRoleBinding()
}
name := *currentItem.GetName()
qws.cache[name] = currentItem
previous, exists := prevCache[name]
if !exists {
watcherEventChanges = append(watcherEventChanges, NewAddWatcherEventChange(currentItem))
} else {
if !proto.Equal(currentItem, previous) {
watcherEventChanges = append(watcherEventChanges, NewModifyWatcherEventChange(currentItem, previous))
}
delete(prevCache, name)
}
}
// remaining items
for _, resource := range prevCache {
watcherEventChanges = append(watcherEventChanges, NewDeleteWatcherEventChange(resource))
}
qws.pendingSnapshot = nil
qws.inSnapshot = false
return watcherEventChanges
}
func (qws *queryWatcherState) transform(rawChanges []*role_binding.RoleBindingChange) []*WatcherEventChange {
watcherEventChanges := make([]*WatcherEventChange, 0, len(rawChanges))
for _, change := range rawChanges {
switch item := change.ChangeType.(type) {
case *role_binding.RoleBindingChange_Added_:
newItem := item.Added.GetRoleBinding()
qws.cache[*newItem.GetName()] = newItem
watcherEventChanges = append(watcherEventChanges, NewAddWatcherEventChange(newItem))
case *role_binding.RoleBindingChange_Modified_:
updatedItem := item.Modified.GetRoleBinding()
previousItem := qws.cache[*updatedItem.GetName()]
qws.cache[*updatedItem.GetName()] = updatedItem
watcherEventChanges = append(watcherEventChanges, NewModifyWatcherEventChange(updatedItem, previousItem))
case *role_binding.RoleBindingChange_Current_:
currentItem := item.Current.GetRoleBinding()
previousItem := qws.cache[*currentItem.GetName()]
qws.cache[*currentItem.GetName()] = currentItem
if previousItem != nil {
watcherEventChanges = append(watcherEventChanges, NewModifyWatcherEventChange(currentItem, previousItem))
} else {
watcherEventChanges = append(watcherEventChanges, NewAddWatcherEventChange(currentItem))
}
case *role_binding.RoleBindingChange_Removed_:
deletedItem := qws.cache[*item.Removed.Name]
delete(qws.cache, *item.Removed.Name)
watcherEventChanges = append(watcherEventChanges, NewDeleteWatcherEventChange(deletedItem))
}
}
return watcherEventChanges
}
func (qws *queryWatcherState) computeSize(pendingChanges []*role_binding.RoleBindingChange) int64 {
size := int64(len(qws.cache))
for _, pendingChange := range append(qws.pendingSnapshot, pendingChanges...) {
name := *pendingChange.GetRoleBindingName()
if pendingChange.IsDelete() {
if _, exists := qws.cache[name]; exists {
size--
}
} else {
if _, exists := qws.cache[name]; !exists {
size++
}
}
}
return size
}
func init() {
gotenaccess.GetRegistry().RegisterWatcherConstructor(role_binding.GetDescriptor(), func(cc grpc.ClientConnInterface, params *gotenaccess.WatcherConfigParams, filters ...gotenaccess.WatcherFilterParams) gotenaccess.Watcher {
cfg := &WatcherConfig{
WatcherConfigBase: params.CfgBase,
WatchType: params.WatchType,
View: params.View,
ChunkSize: params.ChunkSize,
}
if params.FieldMask != nil {
cfg.FieldMask = params.FieldMask.(*role_binding.RoleBinding_FieldMask)
}
if params.OrderBy != nil {
cfg.OrderBy = params.OrderBy.(*role_binding.OrderBy)
}
typedFilters := make([]*WatcherFilterParams, 0, len(filters))
for _, filter := range filters {
typedFilters = append(typedFilters, filter.(*WatcherFilterParams))
}
return NewWatcher(role_binding_client.NewRoleBindingServiceClient(cc), cfg, typedFilters...)
})
gotenaccess.GetRegistry().RegisterWatcherFilterConstructor(role_binding.GetDescriptor(), func(filter gotenresource.Filter, parent gotenresource.Reference) gotenaccess.WatcherFilterParams {
params := &WatcherFilterParams{}
if filter != nil {
params.Filter = filter.(*role_binding.Filter)
}
if parent != nil {
params.Parent = parent.(*role_binding.ParentReference)
}
return params
})
}