-
Notifications
You must be signed in to change notification settings - Fork 2
/
check.pb.go
2062 lines (2004 loc) · 55.1 KB
/
check.pb.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-gogo. DO NOT EDIT.
// source: mixer/v1/check.proto
package v1
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import _ "github.com/gogo/protobuf/types"
import google_rpc "github.com/gogo/googleapis/google/rpc"
import time "time"
import strconv "strconv"
import types "github.com/gogo/protobuf/types"
import strings "strings"
import reflect "reflect"
import sortkeys "github.com/gogo/protobuf/sortkeys"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
// How an attribute's value was matched
type ReferencedAttributes_Condition int32
const (
CONDITION_UNSPECIFIED ReferencedAttributes_Condition = 0
ABSENCE ReferencedAttributes_Condition = 1
EXACT ReferencedAttributes_Condition = 2
REGEX ReferencedAttributes_Condition = 3
)
var ReferencedAttributes_Condition_name = map[int32]string{
0: "CONDITION_UNSPECIFIED",
1: "ABSENCE",
2: "EXACT",
3: "REGEX",
}
var ReferencedAttributes_Condition_value = map[string]int32{
"CONDITION_UNSPECIFIED": 0,
"ABSENCE": 1,
"EXACT": 2,
"REGEX": 3,
}
func (ReferencedAttributes_Condition) EnumDescriptor() ([]byte, []int) {
return fileDescriptorCheck, []int{2, 0}
}
// Used to get a thumbs-up/thumbs-down before performing an action.
type CheckRequest struct {
// The attributes to use for this request.
//
// Mixer's configuration determines how these attributes are used to
// establish the result returned in the response.
Attributes CompressedAttributes `protobuf:"bytes,1,opt,name=attributes" json:"attributes"`
// The number of words in the global dictionary, used with to populate the attributes.
// This value is used as a quick way to determine whether the client is using a dictionary that
// the server understands.
GlobalWordCount uint32 `protobuf:"varint,2,opt,name=global_word_count,json=globalWordCount,proto3" json:"global_word_count,omitempty"`
// Used for deduplicating `Check` calls in the case of failed RPCs and retries. This should be a UUID
// per call, where the same UUID is used for retries of the same call.
DeduplicationId string `protobuf:"bytes,3,opt,name=deduplication_id,json=deduplicationId,proto3" json:"deduplication_id,omitempty"`
// The individual quotas to allocate
Quotas map[string]CheckRequest_QuotaParams `protobuf:"bytes,4,rep,name=quotas" json:"quotas" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
}
func (m *CheckRequest) Reset() { *m = CheckRequest{} }
func (*CheckRequest) ProtoMessage() {}
func (*CheckRequest) Descriptor() ([]byte, []int) { return fileDescriptorCheck, []int{0} }
// parameters for a quota allocation
type CheckRequest_QuotaParams struct {
// Amount of quota to allocate
Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"`
// When true, supports returning less quota than what was requested.
BestEffort bool `protobuf:"varint,2,opt,name=best_effort,json=bestEffort,proto3" json:"best_effort,omitempty"`
}
func (m *CheckRequest_QuotaParams) Reset() { *m = CheckRequest_QuotaParams{} }
func (*CheckRequest_QuotaParams) ProtoMessage() {}
func (*CheckRequest_QuotaParams) Descriptor() ([]byte, []int) { return fileDescriptorCheck, []int{0, 0} }
// The response generated by the Check method.
type CheckResponse struct {
// The precondition check results.
Precondition CheckResponse_PreconditionResult `protobuf:"bytes,2,opt,name=precondition" json:"precondition"`
// The resulting quota, one entry per requested quota.
Quotas map[string]CheckResponse_QuotaResult `protobuf:"bytes,3,rep,name=quotas" json:"quotas" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
}
func (m *CheckResponse) Reset() { *m = CheckResponse{} }
func (*CheckResponse) ProtoMessage() {}
func (*CheckResponse) Descriptor() ([]byte, []int) { return fileDescriptorCheck, []int{1} }
// Expresses the result of a precondition check.
type CheckResponse_PreconditionResult struct {
// A status code of OK indicates all preconditions were satisfied. Any other code indicates not
// all preconditions were satisfied and details describe why.
Status google_rpc.Status `protobuf:"bytes,1,opt,name=status" json:"status"`
// The amount of time for which this result can be considered valid.
ValidDuration time.Duration `protobuf:"bytes,2,opt,name=valid_duration,json=validDuration,stdduration" json:"valid_duration"`
// The number of uses for which this result can be considered valid.
ValidUseCount int32 `protobuf:"varint,3,opt,name=valid_use_count,json=validUseCount,proto3" json:"valid_use_count,omitempty"`
// The attributes returned by Mixer.
//
// The exact set of attributes returned is determined by the set of
// adapters Mixer is configured with. These attributes are used to
// ferry new attributes that Mixer derived based on the input set of
// attributes and its configuration.
Attributes CompressedAttributes `protobuf:"bytes,4,opt,name=attributes" json:"attributes"`
// The total set of attributes that were used in producing the result
// along with matching conditions.
ReferencedAttributes ReferencedAttributes `protobuf:"bytes,5,opt,name=referenced_attributes,json=referencedAttributes" json:"referenced_attributes"`
}
func (m *CheckResponse_PreconditionResult) Reset() { *m = CheckResponse_PreconditionResult{} }
func (*CheckResponse_PreconditionResult) ProtoMessage() {}
func (*CheckResponse_PreconditionResult) Descriptor() ([]byte, []int) {
return fileDescriptorCheck, []int{1, 0}
}
// Expresses the result of a quota allocation.
type CheckResponse_QuotaResult struct {
// The amount of time for which this result can be considered valid.
ValidDuration time.Duration `protobuf:"bytes,1,opt,name=valid_duration,json=validDuration,stdduration" json:"valid_duration"`
// The amount of granted quota. When `QuotaParams.best_effort` is true, this will be >= 0.
// If `QuotaParams.best_effort` is false, this will be either 0 or >= `QuotaParams.amount`.
GrantedAmount int64 `protobuf:"varint,2,opt,name=granted_amount,json=grantedAmount,proto3" json:"granted_amount,omitempty"`
// The total set of attributes that were used in producing the result
// along with matching conditions.
ReferencedAttributes ReferencedAttributes `protobuf:"bytes,5,opt,name=referenced_attributes,json=referencedAttributes" json:"referenced_attributes"`
}
func (m *CheckResponse_QuotaResult) Reset() { *m = CheckResponse_QuotaResult{} }
func (*CheckResponse_QuotaResult) ProtoMessage() {}
func (*CheckResponse_QuotaResult) Descriptor() ([]byte, []int) {
return fileDescriptorCheck, []int{1, 1}
}
// Describes the attributes that were used to determine the response.
// This can be used to construct a response cache.
type ReferencedAttributes struct {
// The message-level dictionary. Refer to [CompressedAttributes][istio.mixer.v1.CompressedAttributes] for information
// on using dictionaries.
Words []string `protobuf:"bytes,1,rep,name=words" json:"words,omitempty"`
// Describes a set of attributes.
AttributeMatches []ReferencedAttributes_AttributeMatch `protobuf:"bytes,2,rep,name=attribute_matches,json=attributeMatches" json:"attribute_matches"`
}
func (m *ReferencedAttributes) Reset() { *m = ReferencedAttributes{} }
func (*ReferencedAttributes) ProtoMessage() {}
func (*ReferencedAttributes) Descriptor() ([]byte, []int) { return fileDescriptorCheck, []int{2} }
// Describes a single attribute match.
type ReferencedAttributes_AttributeMatch struct {
// The name of the attribute. This is a dictionary index encoded in a manner identical
// to all strings in the [CompressedAttributes][istio.mixer.v1.CompressedAttributes] message.
Name int32 `protobuf:"zigzag32,1,opt,name=name,proto3" json:"name,omitempty"`
// The kind of match against the attribute value.
Condition ReferencedAttributes_Condition `protobuf:"varint,2,opt,name=condition,proto3,enum=istio.mixer.v1.ReferencedAttributes_Condition" json:"condition,omitempty"`
// If a REGEX condition is provided for a STRING_MAP attribute,
// clients should use the regex value to match against map keys.
Regex string `protobuf:"bytes,3,opt,name=regex,proto3" json:"regex,omitempty"`
// A key in a STRING_MAP. When multiple keys from a STRING_MAP
// attribute were referenced, there will be multiple AttributeMatch
// messages with different map_key values. Values for map_key SHOULD
// be ignored for attributes that are not STRING_MAP.
//
// Indices for the keys are used (taken either from the
// message dictionary from the `words` field or the global dictionary).
//
// If no map_key value is provided for a STRING_MAP attribute, the
// entire STRING_MAP will be used.
MapKey int32 `protobuf:"zigzag32,4,opt,name=map_key,json=mapKey,proto3" json:"map_key,omitempty"`
}
func (m *ReferencedAttributes_AttributeMatch) Reset() { *m = ReferencedAttributes_AttributeMatch{} }
func (*ReferencedAttributes_AttributeMatch) ProtoMessage() {}
func (*ReferencedAttributes_AttributeMatch) Descriptor() ([]byte, []int) {
return fileDescriptorCheck, []int{2, 0}
}
func init() {
proto.RegisterType((*CheckRequest)(nil), "istio.mixer.v1.CheckRequest")
proto.RegisterType((*CheckRequest_QuotaParams)(nil), "istio.mixer.v1.CheckRequest.QuotaParams")
proto.RegisterType((*CheckResponse)(nil), "istio.mixer.v1.CheckResponse")
proto.RegisterType((*CheckResponse_PreconditionResult)(nil), "istio.mixer.v1.CheckResponse.PreconditionResult")
proto.RegisterType((*CheckResponse_QuotaResult)(nil), "istio.mixer.v1.CheckResponse.QuotaResult")
proto.RegisterType((*ReferencedAttributes)(nil), "istio.mixer.v1.ReferencedAttributes")
proto.RegisterType((*ReferencedAttributes_AttributeMatch)(nil), "istio.mixer.v1.ReferencedAttributes.AttributeMatch")
proto.RegisterEnum("istio.mixer.v1.ReferencedAttributes_Condition", ReferencedAttributes_Condition_name, ReferencedAttributes_Condition_value)
}
func (x ReferencedAttributes_Condition) String() string {
s, ok := ReferencedAttributes_Condition_name[int32(x)]
if ok {
return s
}
return strconv.Itoa(int(x))
}
func (m *CheckRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CheckRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintCheck(dAtA, i, uint64(m.Attributes.Size()))
n1, err := m.Attributes.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if m.GlobalWordCount != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintCheck(dAtA, i, uint64(m.GlobalWordCount))
}
if len(m.DeduplicationId) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintCheck(dAtA, i, uint64(len(m.DeduplicationId)))
i += copy(dAtA[i:], m.DeduplicationId)
}
if len(m.Quotas) > 0 {
for k, _ := range m.Quotas {
dAtA[i] = 0x22
i++
v := m.Quotas[k]
msgSize := 0
if (&v) != nil {
msgSize = (&v).Size()
msgSize += 1 + sovCheck(uint64(msgSize))
}
mapSize := 1 + len(k) + sovCheck(uint64(len(k))) + msgSize
i = encodeVarintCheck(dAtA, i, uint64(mapSize))
dAtA[i] = 0xa
i++
i = encodeVarintCheck(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintCheck(dAtA, i, uint64((&v).Size()))
n2, err := (&v).MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
}
return i, nil
}
func (m *CheckRequest_QuotaParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CheckRequest_QuotaParams) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Amount != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintCheck(dAtA, i, uint64(m.Amount))
}
if m.BestEffort {
dAtA[i] = 0x10
i++
if m.BestEffort {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
return i, nil
}
func (m *CheckResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CheckResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0x12
i++
i = encodeVarintCheck(dAtA, i, uint64(m.Precondition.Size()))
n3, err := m.Precondition.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if len(m.Quotas) > 0 {
for k, _ := range m.Quotas {
dAtA[i] = 0x1a
i++
v := m.Quotas[k]
msgSize := 0
if (&v) != nil {
msgSize = (&v).Size()
msgSize += 1 + sovCheck(uint64(msgSize))
}
mapSize := 1 + len(k) + sovCheck(uint64(len(k))) + msgSize
i = encodeVarintCheck(dAtA, i, uint64(mapSize))
dAtA[i] = 0xa
i++
i = encodeVarintCheck(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintCheck(dAtA, i, uint64((&v).Size()))
n4, err := (&v).MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
}
}
return i, nil
}
func (m *CheckResponse_PreconditionResult) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CheckResponse_PreconditionResult) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintCheck(dAtA, i, uint64(m.Status.Size()))
n5, err := m.Status.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n5
dAtA[i] = 0x12
i++
i = encodeVarintCheck(dAtA, i, uint64(types.SizeOfStdDuration(m.ValidDuration)))
n6, err := types.StdDurationMarshalTo(m.ValidDuration, dAtA[i:])
if err != nil {
return 0, err
}
i += n6
if m.ValidUseCount != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintCheck(dAtA, i, uint64(m.ValidUseCount))
}
dAtA[i] = 0x22
i++
i = encodeVarintCheck(dAtA, i, uint64(m.Attributes.Size()))
n7, err := m.Attributes.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n7
dAtA[i] = 0x2a
i++
i = encodeVarintCheck(dAtA, i, uint64(m.ReferencedAttributes.Size()))
n8, err := m.ReferencedAttributes.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n8
return i, nil
}
func (m *CheckResponse_QuotaResult) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *CheckResponse_QuotaResult) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintCheck(dAtA, i, uint64(types.SizeOfStdDuration(m.ValidDuration)))
n9, err := types.StdDurationMarshalTo(m.ValidDuration, dAtA[i:])
if err != nil {
return 0, err
}
i += n9
if m.GrantedAmount != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintCheck(dAtA, i, uint64(m.GrantedAmount))
}
dAtA[i] = 0x2a
i++
i = encodeVarintCheck(dAtA, i, uint64(m.ReferencedAttributes.Size()))
n10, err := m.ReferencedAttributes.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n10
return i, nil
}
func (m *ReferencedAttributes) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ReferencedAttributes) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Words) > 0 {
for _, s := range m.Words {
dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
if len(m.AttributeMatches) > 0 {
for _, msg := range m.AttributeMatches {
dAtA[i] = 0x12
i++
i = encodeVarintCheck(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
return i, nil
}
func (m *ReferencedAttributes_AttributeMatch) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ReferencedAttributes_AttributeMatch) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Name != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintCheck(dAtA, i, uint64((uint32(m.Name)<<1)^uint32((m.Name>>31))))
}
if m.Condition != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintCheck(dAtA, i, uint64(m.Condition))
}
if len(m.Regex) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintCheck(dAtA, i, uint64(len(m.Regex)))
i += copy(dAtA[i:], m.Regex)
}
if m.MapKey != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintCheck(dAtA, i, uint64((uint32(m.MapKey)<<1)^uint32((m.MapKey>>31))))
}
return i, nil
}
func encodeVarintCheck(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *CheckRequest) Size() (n int) {
var l int
_ = l
l = m.Attributes.Size()
n += 1 + l + sovCheck(uint64(l))
if m.GlobalWordCount != 0 {
n += 1 + sovCheck(uint64(m.GlobalWordCount))
}
l = len(m.DeduplicationId)
if l > 0 {
n += 1 + l + sovCheck(uint64(l))
}
if len(m.Quotas) > 0 {
for k, v := range m.Quotas {
_ = k
_ = v
l = v.Size()
mapEntrySize := 1 + len(k) + sovCheck(uint64(len(k))) + 1 + l + sovCheck(uint64(l))
n += mapEntrySize + 1 + sovCheck(uint64(mapEntrySize))
}
}
return n
}
func (m *CheckRequest_QuotaParams) Size() (n int) {
var l int
_ = l
if m.Amount != 0 {
n += 1 + sovCheck(uint64(m.Amount))
}
if m.BestEffort {
n += 2
}
return n
}
func (m *CheckResponse) Size() (n int) {
var l int
_ = l
l = m.Precondition.Size()
n += 1 + l + sovCheck(uint64(l))
if len(m.Quotas) > 0 {
for k, v := range m.Quotas {
_ = k
_ = v
l = v.Size()
mapEntrySize := 1 + len(k) + sovCheck(uint64(len(k))) + 1 + l + sovCheck(uint64(l))
n += mapEntrySize + 1 + sovCheck(uint64(mapEntrySize))
}
}
return n
}
func (m *CheckResponse_PreconditionResult) Size() (n int) {
var l int
_ = l
l = m.Status.Size()
n += 1 + l + sovCheck(uint64(l))
l = types.SizeOfStdDuration(m.ValidDuration)
n += 1 + l + sovCheck(uint64(l))
if m.ValidUseCount != 0 {
n += 1 + sovCheck(uint64(m.ValidUseCount))
}
l = m.Attributes.Size()
n += 1 + l + sovCheck(uint64(l))
l = m.ReferencedAttributes.Size()
n += 1 + l + sovCheck(uint64(l))
return n
}
func (m *CheckResponse_QuotaResult) Size() (n int) {
var l int
_ = l
l = types.SizeOfStdDuration(m.ValidDuration)
n += 1 + l + sovCheck(uint64(l))
if m.GrantedAmount != 0 {
n += 1 + sovCheck(uint64(m.GrantedAmount))
}
l = m.ReferencedAttributes.Size()
n += 1 + l + sovCheck(uint64(l))
return n
}
func (m *ReferencedAttributes) Size() (n int) {
var l int
_ = l
if len(m.Words) > 0 {
for _, s := range m.Words {
l = len(s)
n += 1 + l + sovCheck(uint64(l))
}
}
if len(m.AttributeMatches) > 0 {
for _, e := range m.AttributeMatches {
l = e.Size()
n += 1 + l + sovCheck(uint64(l))
}
}
return n
}
func (m *ReferencedAttributes_AttributeMatch) Size() (n int) {
var l int
_ = l
if m.Name != 0 {
n += 1 + sozCheck(uint64(m.Name))
}
if m.Condition != 0 {
n += 1 + sovCheck(uint64(m.Condition))
}
l = len(m.Regex)
if l > 0 {
n += 1 + l + sovCheck(uint64(l))
}
if m.MapKey != 0 {
n += 1 + sozCheck(uint64(m.MapKey))
}
return n
}
func sovCheck(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozCheck(x uint64) (n int) {
return sovCheck(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *CheckRequest) String() string {
if this == nil {
return "nil"
}
keysForQuotas := make([]string, 0, len(this.Quotas))
for k, _ := range this.Quotas {
keysForQuotas = append(keysForQuotas, k)
}
sortkeys.Strings(keysForQuotas)
mapStringForQuotas := "map[string]CheckRequest_QuotaParams{"
for _, k := range keysForQuotas {
mapStringForQuotas += fmt.Sprintf("%v: %v,", k, this.Quotas[k])
}
mapStringForQuotas += "}"
s := strings.Join([]string{`&CheckRequest{`,
`Attributes:` + strings.Replace(strings.Replace(this.Attributes.String(), "CompressedAttributes", "CompressedAttributes", 1), `&`, ``, 1) + `,`,
`GlobalWordCount:` + fmt.Sprintf("%v", this.GlobalWordCount) + `,`,
`DeduplicationId:` + fmt.Sprintf("%v", this.DeduplicationId) + `,`,
`Quotas:` + mapStringForQuotas + `,`,
`}`,
}, "")
return s
}
func (this *CheckRequest_QuotaParams) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&CheckRequest_QuotaParams{`,
`Amount:` + fmt.Sprintf("%v", this.Amount) + `,`,
`BestEffort:` + fmt.Sprintf("%v", this.BestEffort) + `,`,
`}`,
}, "")
return s
}
func (this *CheckResponse) String() string {
if this == nil {
return "nil"
}
keysForQuotas := make([]string, 0, len(this.Quotas))
for k, _ := range this.Quotas {
keysForQuotas = append(keysForQuotas, k)
}
sortkeys.Strings(keysForQuotas)
mapStringForQuotas := "map[string]CheckResponse_QuotaResult{"
for _, k := range keysForQuotas {
mapStringForQuotas += fmt.Sprintf("%v: %v,", k, this.Quotas[k])
}
mapStringForQuotas += "}"
s := strings.Join([]string{`&CheckResponse{`,
`Precondition:` + strings.Replace(strings.Replace(this.Precondition.String(), "CheckResponse_PreconditionResult", "CheckResponse_PreconditionResult", 1), `&`, ``, 1) + `,`,
`Quotas:` + mapStringForQuotas + `,`,
`}`,
}, "")
return s
}
func (this *CheckResponse_PreconditionResult) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&CheckResponse_PreconditionResult{`,
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "Status", "google_rpc.Status", 1), `&`, ``, 1) + `,`,
`ValidDuration:` + strings.Replace(strings.Replace(this.ValidDuration.String(), "Duration", "google_protobuf1.Duration", 1), `&`, ``, 1) + `,`,
`ValidUseCount:` + fmt.Sprintf("%v", this.ValidUseCount) + `,`,
`Attributes:` + strings.Replace(strings.Replace(this.Attributes.String(), "CompressedAttributes", "CompressedAttributes", 1), `&`, ``, 1) + `,`,
`ReferencedAttributes:` + strings.Replace(strings.Replace(this.ReferencedAttributes.String(), "ReferencedAttributes", "ReferencedAttributes", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *CheckResponse_QuotaResult) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&CheckResponse_QuotaResult{`,
`ValidDuration:` + strings.Replace(strings.Replace(this.ValidDuration.String(), "Duration", "google_protobuf1.Duration", 1), `&`, ``, 1) + `,`,
`GrantedAmount:` + fmt.Sprintf("%v", this.GrantedAmount) + `,`,
`ReferencedAttributes:` + strings.Replace(strings.Replace(this.ReferencedAttributes.String(), "ReferencedAttributes", "ReferencedAttributes", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *ReferencedAttributes) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ReferencedAttributes{`,
`Words:` + fmt.Sprintf("%v", this.Words) + `,`,
`AttributeMatches:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.AttributeMatches), "ReferencedAttributes_AttributeMatch", "ReferencedAttributes_AttributeMatch", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *ReferencedAttributes_AttributeMatch) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ReferencedAttributes_AttributeMatch{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Condition:` + fmt.Sprintf("%v", this.Condition) + `,`,
`Regex:` + fmt.Sprintf("%v", this.Regex) + `,`,
`MapKey:` + fmt.Sprintf("%v", this.MapKey) + `,`,
`}`,
}, "")
return s
}
func valueToStringCheck(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *CheckRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: CheckRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: CheckRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCheck
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Attributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GlobalWordCount", wireType)
}
m.GlobalWordCount = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GlobalWordCount |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DeduplicationId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCheck
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DeduplicationId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Quotas", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthCheck
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Quotas == nil {
m.Quotas = make(map[string]CheckRequest_QuotaParams)
}
var mapkey string
mapvalue := &CheckRequest_QuotaParams{}
for iNdEx < postIndex {
entryPreIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
if fieldNum == 1 {
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapkey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthCheck
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
} else if fieldNum == 2 {
var mapmsglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
mapmsglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if mapmsglen < 0 {
return ErrInvalidLengthCheck
}
postmsgIndex := iNdEx + mapmsglen
if mapmsglen < 0 {
return ErrInvalidLengthCheck
}
if postmsgIndex > l {
return io.ErrUnexpectedEOF
}
mapvalue = &CheckRequest_QuotaParams{}
if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil {
return err