-
Notifications
You must be signed in to change notification settings - Fork 1
/
project_service.pb.fieldpath.go
8093 lines (7138 loc) · 321 KB
/
project_service.pb.fieldpath.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
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-goten-object
// File: edgelq/monitoring/proto/v3/project_service.proto
// DO NOT EDIT!!!
package project_client
import (
"encoding/json"
"fmt"
"reflect"
"strings"
"time"
"github.com/iancoleman/strcase"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/types/known/fieldmaskpb"
gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
)
// proto imports
import (
project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/project"
view "github.com/cloudwan/goten-sdk/runtime/api/view"
watch_type "github.com/cloudwan/goten-sdk/runtime/api/watch_type"
empty "github.com/golang/protobuf/ptypes/empty"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
field_mask "google.golang.org/genproto/protobuf/field_mask"
)
// ensure the imports are used
var (
_ = new(json.Marshaler)
_ = new(fmt.Stringer)
_ = reflect.DeepEqual
_ = strings.Builder{}
_ = time.Second
_ = strcase.ToLowerCamel
_ = codes.NotFound
_ = status.Status{}
_ = protojson.UnmarshalOptions{}
_ = new(proto.Message)
_ = protoregistry.GlobalTypes
_ = fieldmaskpb.FieldMask{}
_ = new(gotenobject.FieldPath)
)
// make sure we're using proto imports
var (
_ = &project.Project{}
_ = &empty.Empty{}
_ = &field_mask.FieldMask{}
_ = ×tamp.Timestamp{}
_ = view.View(0)
_ = watch_type.WatchType(0)
)
// FieldPath provides implementation to handle
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto
type GetProjectRequest_FieldPath interface {
gotenobject.FieldPath
Selector() GetProjectRequest_FieldPathSelector
Get(source *GetProjectRequest) []interface{}
GetSingle(source *GetProjectRequest) (interface{}, bool)
ClearValue(item *GetProjectRequest)
// Those methods build corresponding GetProjectRequest_FieldPathValue
// (or array of values) and holds passed value. Panics if injected type is incorrect.
WithIValue(value interface{}) GetProjectRequest_FieldPathValue
WithIArrayOfValues(values interface{}) GetProjectRequest_FieldPathArrayOfValues
WithIArrayItemValue(value interface{}) GetProjectRequest_FieldPathArrayItemValue
}
type GetProjectRequest_FieldPathSelector int32
const (
GetProjectRequest_FieldPathSelectorName GetProjectRequest_FieldPathSelector = 0
GetProjectRequest_FieldPathSelectorFieldMask GetProjectRequest_FieldPathSelector = 1
GetProjectRequest_FieldPathSelectorView GetProjectRequest_FieldPathSelector = 2
)
func (s GetProjectRequest_FieldPathSelector) String() string {
switch s {
case GetProjectRequest_FieldPathSelectorName:
return "name"
case GetProjectRequest_FieldPathSelectorFieldMask:
return "field_mask"
case GetProjectRequest_FieldPathSelectorView:
return "view"
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", s))
}
}
func BuildGetProjectRequest_FieldPath(fp gotenobject.RawFieldPath) (GetProjectRequest_FieldPath, error) {
if len(fp) == 0 {
return nil, status.Error(codes.InvalidArgument, "empty field path for object GetProjectRequest")
}
if len(fp) == 1 {
switch fp[0] {
case "name":
return &GetProjectRequest_FieldTerminalPath{selector: GetProjectRequest_FieldPathSelectorName}, nil
case "field_mask", "fieldMask", "field-mask":
return &GetProjectRequest_FieldTerminalPath{selector: GetProjectRequest_FieldPathSelectorFieldMask}, nil
case "view":
return &GetProjectRequest_FieldTerminalPath{selector: GetProjectRequest_FieldPathSelectorView}, nil
}
}
return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object GetProjectRequest", fp)
}
func ParseGetProjectRequest_FieldPath(rawField string) (GetProjectRequest_FieldPath, error) {
fp, err := gotenobject.ParseRawFieldPath(rawField)
if err != nil {
return nil, err
}
return BuildGetProjectRequest_FieldPath(fp)
}
func MustParseGetProjectRequest_FieldPath(rawField string) GetProjectRequest_FieldPath {
fp, err := ParseGetProjectRequest_FieldPath(rawField)
if err != nil {
panic(err)
}
return fp
}
type GetProjectRequest_FieldTerminalPath struct {
selector GetProjectRequest_FieldPathSelector
}
var _ GetProjectRequest_FieldPath = (*GetProjectRequest_FieldTerminalPath)(nil)
func (fp *GetProjectRequest_FieldTerminalPath) Selector() GetProjectRequest_FieldPathSelector {
return fp.selector
}
// String returns path representation in proto convention
func (fp *GetProjectRequest_FieldTerminalPath) String() string {
return fp.selector.String()
}
// JSONString returns path representation is JSON convention
func (fp *GetProjectRequest_FieldTerminalPath) JSONString() string {
return strcase.ToLowerCamel(fp.String())
}
// Get returns all values pointed by specific field from source GetProjectRequest
func (fp *GetProjectRequest_FieldTerminalPath) Get(source *GetProjectRequest) (values []interface{}) {
if source != nil {
switch fp.selector {
case GetProjectRequest_FieldPathSelectorName:
if source.Name != nil {
values = append(values, source.Name)
}
case GetProjectRequest_FieldPathSelectorFieldMask:
if source.FieldMask != nil {
values = append(values, source.FieldMask)
}
case GetProjectRequest_FieldPathSelectorView:
values = append(values, source.View)
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
}
return
}
func (fp *GetProjectRequest_FieldTerminalPath) GetRaw(source proto.Message) []interface{} {
return fp.Get(source.(*GetProjectRequest))
}
// GetSingle returns value pointed by specific field of from source GetProjectRequest
func (fp *GetProjectRequest_FieldTerminalPath) GetSingle(source *GetProjectRequest) (interface{}, bool) {
switch fp.selector {
case GetProjectRequest_FieldPathSelectorName:
res := source.GetName()
return res, res != nil
case GetProjectRequest_FieldPathSelectorFieldMask:
res := source.GetFieldMask()
return res, res != nil
case GetProjectRequest_FieldPathSelectorView:
return source.GetView(), source != nil
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
}
func (fp *GetProjectRequest_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
return fp.GetSingle(source.(*GetProjectRequest))
}
// GetDefault returns a default value of the field type
func (fp *GetProjectRequest_FieldTerminalPath) GetDefault() interface{} {
switch fp.selector {
case GetProjectRequest_FieldPathSelectorName:
return (*project.Reference)(nil)
case GetProjectRequest_FieldPathSelectorFieldMask:
return (*project.Project_FieldMask)(nil)
case GetProjectRequest_FieldPathSelectorView:
return view.View_UNSPECIFIED
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
}
func (fp *GetProjectRequest_FieldTerminalPath) ClearValue(item *GetProjectRequest) {
if item != nil {
switch fp.selector {
case GetProjectRequest_FieldPathSelectorName:
item.Name = nil
case GetProjectRequest_FieldPathSelectorFieldMask:
item.FieldMask = nil
case GetProjectRequest_FieldPathSelectorView:
item.View = view.View_UNSPECIFIED
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
}
}
func (fp *GetProjectRequest_FieldTerminalPath) ClearValueRaw(item proto.Message) {
fp.ClearValue(item.(*GetProjectRequest))
}
// IsLeaf - whether field path is holds simple value
func (fp *GetProjectRequest_FieldTerminalPath) IsLeaf() bool {
return fp.selector == GetProjectRequest_FieldPathSelectorName ||
fp.selector == GetProjectRequest_FieldPathSelectorFieldMask ||
fp.selector == GetProjectRequest_FieldPathSelectorView
}
func (fp *GetProjectRequest_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
return []gotenobject.FieldPath{fp}
}
func (fp *GetProjectRequest_FieldTerminalPath) WithIValue(value interface{}) GetProjectRequest_FieldPathValue {
switch fp.selector {
case GetProjectRequest_FieldPathSelectorName:
return &GetProjectRequest_FieldTerminalPathValue{GetProjectRequest_FieldTerminalPath: *fp, value: value.(*project.Reference)}
case GetProjectRequest_FieldPathSelectorFieldMask:
return &GetProjectRequest_FieldTerminalPathValue{GetProjectRequest_FieldTerminalPath: *fp, value: value.(*project.Project_FieldMask)}
case GetProjectRequest_FieldPathSelectorView:
return &GetProjectRequest_FieldTerminalPathValue{GetProjectRequest_FieldTerminalPath: *fp, value: value.(view.View)}
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
}
func (fp *GetProjectRequest_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
return fp.WithIValue(value)
}
func (fp *GetProjectRequest_FieldTerminalPath) WithIArrayOfValues(values interface{}) GetProjectRequest_FieldPathArrayOfValues {
fpaov := &GetProjectRequest_FieldTerminalPathArrayOfValues{GetProjectRequest_FieldTerminalPath: *fp}
switch fp.selector {
case GetProjectRequest_FieldPathSelectorName:
return &GetProjectRequest_FieldTerminalPathArrayOfValues{GetProjectRequest_FieldTerminalPath: *fp, values: values.([]*project.Reference)}
case GetProjectRequest_FieldPathSelectorFieldMask:
return &GetProjectRequest_FieldTerminalPathArrayOfValues{GetProjectRequest_FieldTerminalPath: *fp, values: values.([]*project.Project_FieldMask)}
case GetProjectRequest_FieldPathSelectorView:
return &GetProjectRequest_FieldTerminalPathArrayOfValues{GetProjectRequest_FieldTerminalPath: *fp, values: values.([]view.View)}
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
return fpaov
}
func (fp *GetProjectRequest_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
return fp.WithIArrayOfValues(values)
}
func (fp *GetProjectRequest_FieldTerminalPath) WithIArrayItemValue(value interface{}) GetProjectRequest_FieldPathArrayItemValue {
switch fp.selector {
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fp.selector))
}
}
func (fp *GetProjectRequest_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
return fp.WithIArrayItemValue(value)
}
// GetProjectRequest_FieldPathValue allows storing values for GetProjectRequest fields according to their type
type GetProjectRequest_FieldPathValue interface {
GetProjectRequest_FieldPath
gotenobject.FieldPathValue
SetTo(target **GetProjectRequest)
CompareWith(*GetProjectRequest) (cmp int, comparable bool)
}
func ParseGetProjectRequest_FieldPathValue(pathStr, valueStr string) (GetProjectRequest_FieldPathValue, error) {
fp, err := ParseGetProjectRequest_FieldPath(pathStr)
if err != nil {
return nil, err
}
fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "error parsing GetProjectRequest field path value from %s: %v", valueStr, err)
}
return fpv.(GetProjectRequest_FieldPathValue), nil
}
func MustParseGetProjectRequest_FieldPathValue(pathStr, valueStr string) GetProjectRequest_FieldPathValue {
fpv, err := ParseGetProjectRequest_FieldPathValue(pathStr, valueStr)
if err != nil {
panic(err)
}
return fpv
}
type GetProjectRequest_FieldTerminalPathValue struct {
GetProjectRequest_FieldTerminalPath
value interface{}
}
var _ GetProjectRequest_FieldPathValue = (*GetProjectRequest_FieldTerminalPathValue)(nil)
// GetRawValue returns raw value stored under selected path for 'GetProjectRequest' as interface{}
func (fpv *GetProjectRequest_FieldTerminalPathValue) GetRawValue() interface{} {
return fpv.value
}
func (fpv *GetProjectRequest_FieldTerminalPathValue) AsNameValue() (*project.Reference, bool) {
res, ok := fpv.value.(*project.Reference)
return res, ok
}
func (fpv *GetProjectRequest_FieldTerminalPathValue) AsFieldMaskValue() (*project.Project_FieldMask, bool) {
res, ok := fpv.value.(*project.Project_FieldMask)
return res, ok
}
func (fpv *GetProjectRequest_FieldTerminalPathValue) AsViewValue() (view.View, bool) {
res, ok := fpv.value.(view.View)
return res, ok
}
// SetTo stores value for selected field for object GetProjectRequest
func (fpv *GetProjectRequest_FieldTerminalPathValue) SetTo(target **GetProjectRequest) {
if *target == nil {
*target = new(GetProjectRequest)
}
switch fpv.selector {
case GetProjectRequest_FieldPathSelectorName:
(*target).Name = fpv.value.(*project.Reference)
case GetProjectRequest_FieldPathSelectorFieldMask:
(*target).FieldMask = fpv.value.(*project.Project_FieldMask)
case GetProjectRequest_FieldPathSelectorView:
(*target).View = fpv.value.(view.View)
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fpv.selector))
}
}
func (fpv *GetProjectRequest_FieldTerminalPathValue) SetToRaw(target proto.Message) {
typedObject := target.(*GetProjectRequest)
fpv.SetTo(&typedObject)
}
// CompareWith compares value in the 'GetProjectRequest_FieldTerminalPathValue' with the value under path in 'GetProjectRequest'.
func (fpv *GetProjectRequest_FieldTerminalPathValue) CompareWith(source *GetProjectRequest) (int, bool) {
switch fpv.selector {
case GetProjectRequest_FieldPathSelectorName:
leftValue := fpv.value.(*project.Reference)
rightValue := source.GetName()
if leftValue == nil {
if rightValue != nil {
return -1, true
}
return 0, true
}
if rightValue == nil {
return 1, true
}
if leftValue.String() == rightValue.String() {
return 0, true
} else if leftValue.String() < rightValue.String() {
return -1, true
} else {
return 1, true
}
case GetProjectRequest_FieldPathSelectorFieldMask:
return 0, false
case GetProjectRequest_FieldPathSelectorView:
leftValue := fpv.value.(view.View)
rightValue := source.GetView()
if (leftValue) == (rightValue) {
return 0, true
} else if (leftValue) < (rightValue) {
return -1, true
} else {
return 1, true
}
default:
panic(fmt.Sprintf("Invalid selector for GetProjectRequest: %d", fpv.selector))
}
}
func (fpv *GetProjectRequest_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) {
return fpv.CompareWith(source.(*GetProjectRequest))
}
// GetProjectRequest_FieldPathArrayItemValue allows storing single item in Path-specific values for GetProjectRequest according to their type
// Present only for array (repeated) types.
type GetProjectRequest_FieldPathArrayItemValue interface {
gotenobject.FieldPathArrayItemValue
GetProjectRequest_FieldPath
ContainsValue(*GetProjectRequest) bool
}
// ParseGetProjectRequest_FieldPathArrayItemValue parses string and JSON-encoded value to its Value
func ParseGetProjectRequest_FieldPathArrayItemValue(pathStr, valueStr string) (GetProjectRequest_FieldPathArrayItemValue, error) {
fp, err := ParseGetProjectRequest_FieldPath(pathStr)
if err != nil {
return nil, err
}
fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "error parsing GetProjectRequest field path array item value from %s: %v", valueStr, err)
}
return fpaiv.(GetProjectRequest_FieldPathArrayItemValue), nil
}
func MustParseGetProjectRequest_FieldPathArrayItemValue(pathStr, valueStr string) GetProjectRequest_FieldPathArrayItemValue {
fpaiv, err := ParseGetProjectRequest_FieldPathArrayItemValue(pathStr, valueStr)
if err != nil {
panic(err)
}
return fpaiv
}
type GetProjectRequest_FieldTerminalPathArrayItemValue struct {
GetProjectRequest_FieldTerminalPath
value interface{}
}
var _ GetProjectRequest_FieldPathArrayItemValue = (*GetProjectRequest_FieldTerminalPathArrayItemValue)(nil)
// GetRawValue returns stored element value for array in object GetProjectRequest as interface{}
func (fpaiv *GetProjectRequest_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} {
return fpaiv.value
}
func (fpaiv *GetProjectRequest_FieldTerminalPathArrayItemValue) GetSingle(source *GetProjectRequest) (interface{}, bool) {
return nil, false
}
func (fpaiv *GetProjectRequest_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) {
return fpaiv.GetSingle(source.(*GetProjectRequest))
}
// Contains returns a boolean indicating if value that is being held is present in given 'GetProjectRequest'
func (fpaiv *GetProjectRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *GetProjectRequest) bool {
slice := fpaiv.GetProjectRequest_FieldTerminalPath.Get(source)
for _, v := range slice {
if asProtoMsg, ok := fpaiv.value.(proto.Message); ok {
if proto.Equal(asProtoMsg, v.(proto.Message)) {
return true
}
} else if reflect.DeepEqual(v, fpaiv.value) {
return true
}
}
return false
}
// GetProjectRequest_FieldPathArrayOfValues allows storing slice of values for GetProjectRequest fields according to their type
type GetProjectRequest_FieldPathArrayOfValues interface {
gotenobject.FieldPathArrayOfValues
GetProjectRequest_FieldPath
}
func ParseGetProjectRequest_FieldPathArrayOfValues(pathStr, valuesStr string) (GetProjectRequest_FieldPathArrayOfValues, error) {
fp, err := ParseGetProjectRequest_FieldPath(pathStr)
if err != nil {
return nil, err
}
fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "error parsing GetProjectRequest field path array of values from %s: %v", valuesStr, err)
}
return fpaov.(GetProjectRequest_FieldPathArrayOfValues), nil
}
func MustParseGetProjectRequest_FieldPathArrayOfValues(pathStr, valuesStr string) GetProjectRequest_FieldPathArrayOfValues {
fpaov, err := ParseGetProjectRequest_FieldPathArrayOfValues(pathStr, valuesStr)
if err != nil {
panic(err)
}
return fpaov
}
type GetProjectRequest_FieldTerminalPathArrayOfValues struct {
GetProjectRequest_FieldTerminalPath
values interface{}
}
var _ GetProjectRequest_FieldPathArrayOfValues = (*GetProjectRequest_FieldTerminalPathArrayOfValues)(nil)
func (fpaov *GetProjectRequest_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) {
switch fpaov.selector {
case GetProjectRequest_FieldPathSelectorName:
for _, v := range fpaov.values.([]*project.Reference) {
values = append(values, v)
}
case GetProjectRequest_FieldPathSelectorFieldMask:
for _, v := range fpaov.values.([]*project.Project_FieldMask) {
values = append(values, v)
}
case GetProjectRequest_FieldPathSelectorView:
for _, v := range fpaov.values.([]view.View) {
values = append(values, v)
}
}
return
}
func (fpaov *GetProjectRequest_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*project.Reference, bool) {
res, ok := fpaov.values.([]*project.Reference)
return res, ok
}
func (fpaov *GetProjectRequest_FieldTerminalPathArrayOfValues) AsFieldMaskArrayOfValues() ([]*project.Project_FieldMask, bool) {
res, ok := fpaov.values.([]*project.Project_FieldMask)
return res, ok
}
func (fpaov *GetProjectRequest_FieldTerminalPathArrayOfValues) AsViewArrayOfValues() ([]view.View, bool) {
res, ok := fpaov.values.([]view.View)
return res, ok
}
// FieldPath provides implementation to handle
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto
type BatchGetProjectsRequest_FieldPath interface {
gotenobject.FieldPath
Selector() BatchGetProjectsRequest_FieldPathSelector
Get(source *BatchGetProjectsRequest) []interface{}
GetSingle(source *BatchGetProjectsRequest) (interface{}, bool)
ClearValue(item *BatchGetProjectsRequest)
// Those methods build corresponding BatchGetProjectsRequest_FieldPathValue
// (or array of values) and holds passed value. Panics if injected type is incorrect.
WithIValue(value interface{}) BatchGetProjectsRequest_FieldPathValue
WithIArrayOfValues(values interface{}) BatchGetProjectsRequest_FieldPathArrayOfValues
WithIArrayItemValue(value interface{}) BatchGetProjectsRequest_FieldPathArrayItemValue
}
type BatchGetProjectsRequest_FieldPathSelector int32
const (
BatchGetProjectsRequest_FieldPathSelectorNames BatchGetProjectsRequest_FieldPathSelector = 0
BatchGetProjectsRequest_FieldPathSelectorFieldMask BatchGetProjectsRequest_FieldPathSelector = 1
BatchGetProjectsRequest_FieldPathSelectorView BatchGetProjectsRequest_FieldPathSelector = 2
)
func (s BatchGetProjectsRequest_FieldPathSelector) String() string {
switch s {
case BatchGetProjectsRequest_FieldPathSelectorNames:
return "names"
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
return "field_mask"
case BatchGetProjectsRequest_FieldPathSelectorView:
return "view"
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", s))
}
}
func BuildBatchGetProjectsRequest_FieldPath(fp gotenobject.RawFieldPath) (BatchGetProjectsRequest_FieldPath, error) {
if len(fp) == 0 {
return nil, status.Error(codes.InvalidArgument, "empty field path for object BatchGetProjectsRequest")
}
if len(fp) == 1 {
switch fp[0] {
case "names":
return &BatchGetProjectsRequest_FieldTerminalPath{selector: BatchGetProjectsRequest_FieldPathSelectorNames}, nil
case "field_mask", "fieldMask", "field-mask":
return &BatchGetProjectsRequest_FieldTerminalPath{selector: BatchGetProjectsRequest_FieldPathSelectorFieldMask}, nil
case "view":
return &BatchGetProjectsRequest_FieldTerminalPath{selector: BatchGetProjectsRequest_FieldPathSelectorView}, nil
}
}
return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object BatchGetProjectsRequest", fp)
}
func ParseBatchGetProjectsRequest_FieldPath(rawField string) (BatchGetProjectsRequest_FieldPath, error) {
fp, err := gotenobject.ParseRawFieldPath(rawField)
if err != nil {
return nil, err
}
return BuildBatchGetProjectsRequest_FieldPath(fp)
}
func MustParseBatchGetProjectsRequest_FieldPath(rawField string) BatchGetProjectsRequest_FieldPath {
fp, err := ParseBatchGetProjectsRequest_FieldPath(rawField)
if err != nil {
panic(err)
}
return fp
}
type BatchGetProjectsRequest_FieldTerminalPath struct {
selector BatchGetProjectsRequest_FieldPathSelector
}
var _ BatchGetProjectsRequest_FieldPath = (*BatchGetProjectsRequest_FieldTerminalPath)(nil)
func (fp *BatchGetProjectsRequest_FieldTerminalPath) Selector() BatchGetProjectsRequest_FieldPathSelector {
return fp.selector
}
// String returns path representation in proto convention
func (fp *BatchGetProjectsRequest_FieldTerminalPath) String() string {
return fp.selector.String()
}
// JSONString returns path representation is JSON convention
func (fp *BatchGetProjectsRequest_FieldTerminalPath) JSONString() string {
return strcase.ToLowerCamel(fp.String())
}
// Get returns all values pointed by specific field from source BatchGetProjectsRequest
func (fp *BatchGetProjectsRequest_FieldTerminalPath) Get(source *BatchGetProjectsRequest) (values []interface{}) {
if source != nil {
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
for _, value := range source.GetNames() {
values = append(values, value)
}
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
if source.FieldMask != nil {
values = append(values, source.FieldMask)
}
case BatchGetProjectsRequest_FieldPathSelectorView:
values = append(values, source.View)
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
}
return
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) GetRaw(source proto.Message) []interface{} {
return fp.Get(source.(*BatchGetProjectsRequest))
}
// GetSingle returns value pointed by specific field of from source BatchGetProjectsRequest
func (fp *BatchGetProjectsRequest_FieldTerminalPath) GetSingle(source *BatchGetProjectsRequest) (interface{}, bool) {
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
res := source.GetNames()
return res, res != nil
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
res := source.GetFieldMask()
return res, res != nil
case BatchGetProjectsRequest_FieldPathSelectorView:
return source.GetView(), source != nil
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
return fp.GetSingle(source.(*BatchGetProjectsRequest))
}
// GetDefault returns a default value of the field type
func (fp *BatchGetProjectsRequest_FieldTerminalPath) GetDefault() interface{} {
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
return ([]*project.Reference)(nil)
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
return (*project.Project_FieldMask)(nil)
case BatchGetProjectsRequest_FieldPathSelectorView:
return view.View_UNSPECIFIED
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) ClearValue(item *BatchGetProjectsRequest) {
if item != nil {
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
item.Names = nil
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
item.FieldMask = nil
case BatchGetProjectsRequest_FieldPathSelectorView:
item.View = view.View_UNSPECIFIED
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
}
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) ClearValueRaw(item proto.Message) {
fp.ClearValue(item.(*BatchGetProjectsRequest))
}
// IsLeaf - whether field path is holds simple value
func (fp *BatchGetProjectsRequest_FieldTerminalPath) IsLeaf() bool {
return fp.selector == BatchGetProjectsRequest_FieldPathSelectorNames ||
fp.selector == BatchGetProjectsRequest_FieldPathSelectorFieldMask ||
fp.selector == BatchGetProjectsRequest_FieldPathSelectorView
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
return []gotenobject.FieldPath{fp}
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) WithIValue(value interface{}) BatchGetProjectsRequest_FieldPathValue {
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
return &BatchGetProjectsRequest_FieldTerminalPathValue{BatchGetProjectsRequest_FieldTerminalPath: *fp, value: value.([]*project.Reference)}
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
return &BatchGetProjectsRequest_FieldTerminalPathValue{BatchGetProjectsRequest_FieldTerminalPath: *fp, value: value.(*project.Project_FieldMask)}
case BatchGetProjectsRequest_FieldPathSelectorView:
return &BatchGetProjectsRequest_FieldTerminalPathValue{BatchGetProjectsRequest_FieldTerminalPath: *fp, value: value.(view.View)}
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
return fp.WithIValue(value)
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) WithIArrayOfValues(values interface{}) BatchGetProjectsRequest_FieldPathArrayOfValues {
fpaov := &BatchGetProjectsRequest_FieldTerminalPathArrayOfValues{BatchGetProjectsRequest_FieldTerminalPath: *fp}
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
return &BatchGetProjectsRequest_FieldTerminalPathArrayOfValues{BatchGetProjectsRequest_FieldTerminalPath: *fp, values: values.([][]*project.Reference)}
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
return &BatchGetProjectsRequest_FieldTerminalPathArrayOfValues{BatchGetProjectsRequest_FieldTerminalPath: *fp, values: values.([]*project.Project_FieldMask)}
case BatchGetProjectsRequest_FieldPathSelectorView:
return &BatchGetProjectsRequest_FieldTerminalPathArrayOfValues{BatchGetProjectsRequest_FieldTerminalPath: *fp, values: values.([]view.View)}
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
return fpaov
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
return fp.WithIArrayOfValues(values)
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) WithIArrayItemValue(value interface{}) BatchGetProjectsRequest_FieldPathArrayItemValue {
switch fp.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
return &BatchGetProjectsRequest_FieldTerminalPathArrayItemValue{BatchGetProjectsRequest_FieldTerminalPath: *fp, value: value.(*project.Reference)}
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fp.selector))
}
}
func (fp *BatchGetProjectsRequest_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
return fp.WithIArrayItemValue(value)
}
// BatchGetProjectsRequest_FieldPathValue allows storing values for BatchGetProjectsRequest fields according to their type
type BatchGetProjectsRequest_FieldPathValue interface {
BatchGetProjectsRequest_FieldPath
gotenobject.FieldPathValue
SetTo(target **BatchGetProjectsRequest)
CompareWith(*BatchGetProjectsRequest) (cmp int, comparable bool)
}
func ParseBatchGetProjectsRequest_FieldPathValue(pathStr, valueStr string) (BatchGetProjectsRequest_FieldPathValue, error) {
fp, err := ParseBatchGetProjectsRequest_FieldPath(pathStr)
if err != nil {
return nil, err
}
fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "error parsing BatchGetProjectsRequest field path value from %s: %v", valueStr, err)
}
return fpv.(BatchGetProjectsRequest_FieldPathValue), nil
}
func MustParseBatchGetProjectsRequest_FieldPathValue(pathStr, valueStr string) BatchGetProjectsRequest_FieldPathValue {
fpv, err := ParseBatchGetProjectsRequest_FieldPathValue(pathStr, valueStr)
if err != nil {
panic(err)
}
return fpv
}
type BatchGetProjectsRequest_FieldTerminalPathValue struct {
BatchGetProjectsRequest_FieldTerminalPath
value interface{}
}
var _ BatchGetProjectsRequest_FieldPathValue = (*BatchGetProjectsRequest_FieldTerminalPathValue)(nil)
// GetRawValue returns raw value stored under selected path for 'BatchGetProjectsRequest' as interface{}
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) GetRawValue() interface{} {
return fpv.value
}
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) AsNamesValue() ([]*project.Reference, bool) {
res, ok := fpv.value.([]*project.Reference)
return res, ok
}
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) AsFieldMaskValue() (*project.Project_FieldMask, bool) {
res, ok := fpv.value.(*project.Project_FieldMask)
return res, ok
}
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) AsViewValue() (view.View, bool) {
res, ok := fpv.value.(view.View)
return res, ok
}
// SetTo stores value for selected field for object BatchGetProjectsRequest
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) SetTo(target **BatchGetProjectsRequest) {
if *target == nil {
*target = new(BatchGetProjectsRequest)
}
switch fpv.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
(*target).Names = fpv.value.([]*project.Reference)
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
(*target).FieldMask = fpv.value.(*project.Project_FieldMask)
case BatchGetProjectsRequest_FieldPathSelectorView:
(*target).View = fpv.value.(view.View)
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fpv.selector))
}
}
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) SetToRaw(target proto.Message) {
typedObject := target.(*BatchGetProjectsRequest)
fpv.SetTo(&typedObject)
}
// CompareWith compares value in the 'BatchGetProjectsRequest_FieldTerminalPathValue' with the value under path in 'BatchGetProjectsRequest'.
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) CompareWith(source *BatchGetProjectsRequest) (int, bool) {
switch fpv.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
return 0, false
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
return 0, false
case BatchGetProjectsRequest_FieldPathSelectorView:
leftValue := fpv.value.(view.View)
rightValue := source.GetView()
if (leftValue) == (rightValue) {
return 0, true
} else if (leftValue) < (rightValue) {
return -1, true
} else {
return 1, true
}
default:
panic(fmt.Sprintf("Invalid selector for BatchGetProjectsRequest: %d", fpv.selector))
}
}
func (fpv *BatchGetProjectsRequest_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) {
return fpv.CompareWith(source.(*BatchGetProjectsRequest))
}
// BatchGetProjectsRequest_FieldPathArrayItemValue allows storing single item in Path-specific values for BatchGetProjectsRequest according to their type
// Present only for array (repeated) types.
type BatchGetProjectsRequest_FieldPathArrayItemValue interface {
gotenobject.FieldPathArrayItemValue
BatchGetProjectsRequest_FieldPath
ContainsValue(*BatchGetProjectsRequest) bool
}
// ParseBatchGetProjectsRequest_FieldPathArrayItemValue parses string and JSON-encoded value to its Value
func ParseBatchGetProjectsRequest_FieldPathArrayItemValue(pathStr, valueStr string) (BatchGetProjectsRequest_FieldPathArrayItemValue, error) {
fp, err := ParseBatchGetProjectsRequest_FieldPath(pathStr)
if err != nil {
return nil, err
}
fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "error parsing BatchGetProjectsRequest field path array item value from %s: %v", valueStr, err)
}
return fpaiv.(BatchGetProjectsRequest_FieldPathArrayItemValue), nil
}
func MustParseBatchGetProjectsRequest_FieldPathArrayItemValue(pathStr, valueStr string) BatchGetProjectsRequest_FieldPathArrayItemValue {
fpaiv, err := ParseBatchGetProjectsRequest_FieldPathArrayItemValue(pathStr, valueStr)
if err != nil {
panic(err)
}
return fpaiv
}
type BatchGetProjectsRequest_FieldTerminalPathArrayItemValue struct {
BatchGetProjectsRequest_FieldTerminalPath
value interface{}
}
var _ BatchGetProjectsRequest_FieldPathArrayItemValue = (*BatchGetProjectsRequest_FieldTerminalPathArrayItemValue)(nil)
// GetRawValue returns stored element value for array in object BatchGetProjectsRequest as interface{}
func (fpaiv *BatchGetProjectsRequest_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} {
return fpaiv.value
}
func (fpaiv *BatchGetProjectsRequest_FieldTerminalPathArrayItemValue) AsNamesItemValue() (*project.Reference, bool) {
res, ok := fpaiv.value.(*project.Reference)
return res, ok
}
func (fpaiv *BatchGetProjectsRequest_FieldTerminalPathArrayItemValue) GetSingle(source *BatchGetProjectsRequest) (interface{}, bool) {
return nil, false
}
func (fpaiv *BatchGetProjectsRequest_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) {
return fpaiv.GetSingle(source.(*BatchGetProjectsRequest))
}
// Contains returns a boolean indicating if value that is being held is present in given 'BatchGetProjectsRequest'
func (fpaiv *BatchGetProjectsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *BatchGetProjectsRequest) bool {
slice := fpaiv.BatchGetProjectsRequest_FieldTerminalPath.Get(source)
for _, v := range slice {
if asProtoMsg, ok := fpaiv.value.(proto.Message); ok {
if proto.Equal(asProtoMsg, v.(proto.Message)) {
return true
}
} else if reflect.DeepEqual(v, fpaiv.value) {
return true
}
}
return false
}
// BatchGetProjectsRequest_FieldPathArrayOfValues allows storing slice of values for BatchGetProjectsRequest fields according to their type
type BatchGetProjectsRequest_FieldPathArrayOfValues interface {
gotenobject.FieldPathArrayOfValues
BatchGetProjectsRequest_FieldPath
}
func ParseBatchGetProjectsRequest_FieldPathArrayOfValues(pathStr, valuesStr string) (BatchGetProjectsRequest_FieldPathArrayOfValues, error) {
fp, err := ParseBatchGetProjectsRequest_FieldPath(pathStr)
if err != nil {
return nil, err
}
fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "error parsing BatchGetProjectsRequest field path array of values from %s: %v", valuesStr, err)
}
return fpaov.(BatchGetProjectsRequest_FieldPathArrayOfValues), nil
}
func MustParseBatchGetProjectsRequest_FieldPathArrayOfValues(pathStr, valuesStr string) BatchGetProjectsRequest_FieldPathArrayOfValues {
fpaov, err := ParseBatchGetProjectsRequest_FieldPathArrayOfValues(pathStr, valuesStr)
if err != nil {
panic(err)
}
return fpaov
}
type BatchGetProjectsRequest_FieldTerminalPathArrayOfValues struct {
BatchGetProjectsRequest_FieldTerminalPath
values interface{}
}
var _ BatchGetProjectsRequest_FieldPathArrayOfValues = (*BatchGetProjectsRequest_FieldTerminalPathArrayOfValues)(nil)
func (fpaov *BatchGetProjectsRequest_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) {
switch fpaov.selector {
case BatchGetProjectsRequest_FieldPathSelectorNames:
for _, v := range fpaov.values.([][]*project.Reference) {
values = append(values, v)
}
case BatchGetProjectsRequest_FieldPathSelectorFieldMask:
for _, v := range fpaov.values.([]*project.Project_FieldMask) {
values = append(values, v)
}
case BatchGetProjectsRequest_FieldPathSelectorView:
for _, v := range fpaov.values.([]view.View) {
values = append(values, v)
}
}
return
}
func (fpaov *BatchGetProjectsRequest_FieldTerminalPathArrayOfValues) AsNamesArrayOfValues() ([][]*project.Reference, bool) {
res, ok := fpaov.values.([][]*project.Reference)
return res, ok
}
func (fpaov *BatchGetProjectsRequest_FieldTerminalPathArrayOfValues) AsFieldMaskArrayOfValues() ([]*project.Project_FieldMask, bool) {
res, ok := fpaov.values.([]*project.Project_FieldMask)
return res, ok
}
func (fpaov *BatchGetProjectsRequest_FieldTerminalPathArrayOfValues) AsViewArrayOfValues() ([]view.View, bool) {
res, ok := fpaov.values.([]view.View)
return res, ok
}
// FieldPath provides implementation to handle
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto
type BatchGetProjectsResponse_FieldPath interface {
gotenobject.FieldPath
Selector() BatchGetProjectsResponse_FieldPathSelector
Get(source *BatchGetProjectsResponse) []interface{}
GetSingle(source *BatchGetProjectsResponse) (interface{}, bool)
ClearValue(item *BatchGetProjectsResponse)