github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/ruler/rulespb/rules.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: pkg/ruler/rulespb/rules.proto 3 4 package rulespb 5 6 import ( 7 fmt "fmt" 8 _ "github.com/gogo/protobuf/gogoproto" 9 proto "github.com/gogo/protobuf/proto" 10 github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" 11 types "github.com/gogo/protobuf/types" 12 _ "github.com/golang/protobuf/ptypes/duration" 13 _ "github.com/grafana/loki/pkg/logproto" 14 github_com_grafana_loki_pkg_logproto "github.com/grafana/loki/pkg/logproto" 15 io "io" 16 math "math" 17 math_bits "math/bits" 18 reflect "reflect" 19 strings "strings" 20 time "time" 21 ) 22 23 // Reference imports to suppress errors if they are not otherwise used. 24 var _ = proto.Marshal 25 var _ = fmt.Errorf 26 var _ = math.Inf 27 var _ = time.Kitchen 28 29 // This is a compile-time assertion to ensure that this generated file 30 // is compatible with the proto package it is being compiled against. 31 // A compilation error at this line likely means your copy of the 32 // proto package needs to be updated. 33 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 34 35 // RuleGroupDesc is a proto representation of a rule group. 36 type RuleGroupDesc struct { 37 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 38 Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` 39 Interval time.Duration `protobuf:"bytes,3,opt,name=interval,proto3,stdduration" json:"interval"` 40 Rules []*RuleDesc `protobuf:"bytes,4,rep,name=rules,proto3" json:"rules,omitempty"` 41 User string `protobuf:"bytes,6,opt,name=user,proto3" json:"user,omitempty"` 42 // The options field can be used to extend Ruler functionality without 43 // having to repeatedly redefine the proto description. It can also be leveraged 44 // to create custom `ManagerOpts` based on rule configs which can then be passed 45 // to the Prometheus Manager. 46 Options []*types.Any `protobuf:"bytes,9,rep,name=options,proto3" json:"options,omitempty"` 47 } 48 49 func (m *RuleGroupDesc) Reset() { *m = RuleGroupDesc{} } 50 func (*RuleGroupDesc) ProtoMessage() {} 51 func (*RuleGroupDesc) Descriptor() ([]byte, []int) { 52 return fileDescriptor_dd3ef3757f506fba, []int{0} 53 } 54 func (m *RuleGroupDesc) XXX_Unmarshal(b []byte) error { 55 return m.Unmarshal(b) 56 } 57 func (m *RuleGroupDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 58 if deterministic { 59 return xxx_messageInfo_RuleGroupDesc.Marshal(b, m, deterministic) 60 } else { 61 b = b[:cap(b)] 62 n, err := m.MarshalToSizedBuffer(b) 63 if err != nil { 64 return nil, err 65 } 66 return b[:n], nil 67 } 68 } 69 func (m *RuleGroupDesc) XXX_Merge(src proto.Message) { 70 xxx_messageInfo_RuleGroupDesc.Merge(m, src) 71 } 72 func (m *RuleGroupDesc) XXX_Size() int { 73 return m.Size() 74 } 75 func (m *RuleGroupDesc) XXX_DiscardUnknown() { 76 xxx_messageInfo_RuleGroupDesc.DiscardUnknown(m) 77 } 78 79 var xxx_messageInfo_RuleGroupDesc proto.InternalMessageInfo 80 81 func (m *RuleGroupDesc) GetName() string { 82 if m != nil { 83 return m.Name 84 } 85 return "" 86 } 87 88 func (m *RuleGroupDesc) GetNamespace() string { 89 if m != nil { 90 return m.Namespace 91 } 92 return "" 93 } 94 95 func (m *RuleGroupDesc) GetInterval() time.Duration { 96 if m != nil { 97 return m.Interval 98 } 99 return 0 100 } 101 102 func (m *RuleGroupDesc) GetRules() []*RuleDesc { 103 if m != nil { 104 return m.Rules 105 } 106 return nil 107 } 108 109 func (m *RuleGroupDesc) GetUser() string { 110 if m != nil { 111 return m.User 112 } 113 return "" 114 } 115 116 func (m *RuleGroupDesc) GetOptions() []*types.Any { 117 if m != nil { 118 return m.Options 119 } 120 return nil 121 } 122 123 // RuleDesc is a proto representation of a Prometheus Rule 124 type RuleDesc struct { 125 Expr string `protobuf:"bytes,1,opt,name=expr,proto3" json:"expr,omitempty"` 126 Record string `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"` 127 Alert string `protobuf:"bytes,3,opt,name=alert,proto3" json:"alert,omitempty"` 128 For time.Duration `protobuf:"bytes,4,opt,name=for,proto3,stdduration" json:"for"` 129 Labels []github_com_grafana_loki_pkg_logproto.LabelAdapter `protobuf:"bytes,5,rep,name=labels,proto3,customtype=github.com/grafana/loki/pkg/logproto.LabelAdapter" json:"labels"` 130 Annotations []github_com_grafana_loki_pkg_logproto.LabelAdapter `protobuf:"bytes,6,rep,name=annotations,proto3,customtype=github.com/grafana/loki/pkg/logproto.LabelAdapter" json:"annotations"` 131 } 132 133 func (m *RuleDesc) Reset() { *m = RuleDesc{} } 134 func (*RuleDesc) ProtoMessage() {} 135 func (*RuleDesc) Descriptor() ([]byte, []int) { 136 return fileDescriptor_dd3ef3757f506fba, []int{1} 137 } 138 func (m *RuleDesc) XXX_Unmarshal(b []byte) error { 139 return m.Unmarshal(b) 140 } 141 func (m *RuleDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 142 if deterministic { 143 return xxx_messageInfo_RuleDesc.Marshal(b, m, deterministic) 144 } else { 145 b = b[:cap(b)] 146 n, err := m.MarshalToSizedBuffer(b) 147 if err != nil { 148 return nil, err 149 } 150 return b[:n], nil 151 } 152 } 153 func (m *RuleDesc) XXX_Merge(src proto.Message) { 154 xxx_messageInfo_RuleDesc.Merge(m, src) 155 } 156 func (m *RuleDesc) XXX_Size() int { 157 return m.Size() 158 } 159 func (m *RuleDesc) XXX_DiscardUnknown() { 160 xxx_messageInfo_RuleDesc.DiscardUnknown(m) 161 } 162 163 var xxx_messageInfo_RuleDesc proto.InternalMessageInfo 164 165 func (m *RuleDesc) GetExpr() string { 166 if m != nil { 167 return m.Expr 168 } 169 return "" 170 } 171 172 func (m *RuleDesc) GetRecord() string { 173 if m != nil { 174 return m.Record 175 } 176 return "" 177 } 178 179 func (m *RuleDesc) GetAlert() string { 180 if m != nil { 181 return m.Alert 182 } 183 return "" 184 } 185 186 func (m *RuleDesc) GetFor() time.Duration { 187 if m != nil { 188 return m.For 189 } 190 return 0 191 } 192 193 func init() { 194 proto.RegisterType((*RuleGroupDesc)(nil), "rules.RuleGroupDesc") 195 proto.RegisterType((*RuleDesc)(nil), "rules.RuleDesc") 196 } 197 198 func init() { proto.RegisterFile("pkg/ruler/rulespb/rules.proto", fileDescriptor_dd3ef3757f506fba) } 199 200 var fileDescriptor_dd3ef3757f506fba = []byte{ 201 // 493 bytes of a gzipped FileDescriptorProto 202 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x41, 0x6f, 0xd3, 0x30, 203 0x18, 0x8d, 0xd7, 0x34, 0x4b, 0x5c, 0x4d, 0x54, 0xd6, 0x84, 0xd2, 0x01, 0x6e, 0x35, 0x09, 0xa9, 204 0x1c, 0x70, 0xc4, 0x10, 0x07, 0x4e, 0x68, 0xd5, 0x24, 0xa4, 0x6a, 0x07, 0x94, 0x23, 0x17, 0xe4, 205 0xa4, 0x6e, 0x88, 0xe6, 0xc5, 0x91, 0x93, 0x4c, 0xf4, 0xc6, 0x4f, 0xe0, 0xc8, 0x4f, 0xe0, 0xa7, 206 0xec, 0xd8, 0xe3, 0xc4, 0x61, 0xd0, 0xf4, 0xc2, 0x8d, 0xfd, 0x03, 0x90, 0xed, 0x64, 0x2d, 0x20, 207 0x21, 0x2e, 0x5c, 0xe2, 0xef, 0xcb, 0xf3, 0xf3, 0x7b, 0xdf, 0x73, 0x02, 0x1f, 0xe4, 0x67, 0x49, 208 0x20, 0x2b, 0xce, 0xa4, 0x7e, 0x16, 0x79, 0x64, 0x56, 0x92, 0x4b, 0x51, 0x0a, 0xd4, 0xd5, 0xcd, 209 0xc1, 0xe3, 0x24, 0x2d, 0xdf, 0x56, 0x11, 0x89, 0xc5, 0x79, 0x90, 0x88, 0x44, 0x04, 0x1a, 0x8d, 210 0xaa, 0xb9, 0xee, 0x74, 0xa3, 0x2b, 0xc3, 0x3a, 0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235 func (this *RuleGroupDesc) Equal(that interface{}) bool { 236 if that == nil { 237 return this == nil 238 } 239 240 that1, ok := that.(*RuleGroupDesc) 241 if !ok { 242 that2, ok := that.(RuleGroupDesc) 243 if ok { 244 that1 = &that2 245 } else { 246 return false 247 } 248 } 249 if that1 == nil { 250 return this == nil 251 } else if this == nil { 252 return false 253 } 254 if this.Name != that1.Name { 255 return false 256 } 257 if this.Namespace != that1.Namespace { 258 return false 259 } 260 if this.Interval != that1.Interval { 261 return false 262 } 263 if len(this.Rules) != len(that1.Rules) { 264 return false 265 } 266 for i := range this.Rules { 267 if !this.Rules[i].Equal(that1.Rules[i]) { 268 return false 269 } 270 } 271 if this.User != that1.User { 272 return false 273 } 274 if len(this.Options) != len(that1.Options) { 275 return false 276 } 277 for i := range this.Options { 278 if !this.Options[i].Equal(that1.Options[i]) { 279 return false 280 } 281 } 282 return true 283 } 284 func (this *RuleDesc) Equal(that interface{}) bool { 285 if that == nil { 286 return this == nil 287 } 288 289 that1, ok := that.(*RuleDesc) 290 if !ok { 291 that2, ok := that.(RuleDesc) 292 if ok { 293 that1 = &that2 294 } else { 295 return false 296 } 297 } 298 if that1 == nil { 299 return this == nil 300 } else if this == nil { 301 return false 302 } 303 if this.Expr != that1.Expr { 304 return false 305 } 306 if this.Record != that1.Record { 307 return false 308 } 309 if this.Alert != that1.Alert { 310 return false 311 } 312 if this.For != that1.For { 313 return false 314 } 315 if len(this.Labels) != len(that1.Labels) { 316 return false 317 } 318 for i := range this.Labels { 319 if !this.Labels[i].Equal(that1.Labels[i]) { 320 return false 321 } 322 } 323 if len(this.Annotations) != len(that1.Annotations) { 324 return false 325 } 326 for i := range this.Annotations { 327 if !this.Annotations[i].Equal(that1.Annotations[i]) { 328 return false 329 } 330 } 331 return true 332 } 333 func (this *RuleGroupDesc) GoString() string { 334 if this == nil { 335 return "nil" 336 } 337 s := make([]string, 0, 10) 338 s = append(s, "&rulespb.RuleGroupDesc{") 339 s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") 340 s = append(s, "Namespace: "+fmt.Sprintf("%#v", this.Namespace)+",\n") 341 s = append(s, "Interval: "+fmt.Sprintf("%#v", this.Interval)+",\n") 342 if this.Rules != nil { 343 s = append(s, "Rules: "+fmt.Sprintf("%#v", this.Rules)+",\n") 344 } 345 s = append(s, "User: "+fmt.Sprintf("%#v", this.User)+",\n") 346 if this.Options != nil { 347 s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") 348 } 349 s = append(s, "}") 350 return strings.Join(s, "") 351 } 352 func (this *RuleDesc) GoString() string { 353 if this == nil { 354 return "nil" 355 } 356 s := make([]string, 0, 10) 357 s = append(s, "&rulespb.RuleDesc{") 358 s = append(s, "Expr: "+fmt.Sprintf("%#v", this.Expr)+",\n") 359 s = append(s, "Record: "+fmt.Sprintf("%#v", this.Record)+",\n") 360 s = append(s, "Alert: "+fmt.Sprintf("%#v", this.Alert)+",\n") 361 s = append(s, "For: "+fmt.Sprintf("%#v", this.For)+",\n") 362 s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") 363 s = append(s, "Annotations: "+fmt.Sprintf("%#v", this.Annotations)+",\n") 364 s = append(s, "}") 365 return strings.Join(s, "") 366 } 367 func valueToGoStringRules(v interface{}, typ string) string { 368 rv := reflect.ValueOf(v) 369 if rv.IsNil() { 370 return "nil" 371 } 372 pv := reflect.Indirect(rv).Interface() 373 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 374 } 375 func (m *RuleGroupDesc) Marshal() (dAtA []byte, err error) { 376 size := m.Size() 377 dAtA = make([]byte, size) 378 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 379 if err != nil { 380 return nil, err 381 } 382 return dAtA[:n], nil 383 } 384 385 func (m *RuleGroupDesc) MarshalTo(dAtA []byte) (int, error) { 386 size := m.Size() 387 return m.MarshalToSizedBuffer(dAtA[:size]) 388 } 389 390 func (m *RuleGroupDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { 391 i := len(dAtA) 392 _ = i 393 var l int 394 _ = l 395 if len(m.Options) > 0 { 396 for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { 397 { 398 size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 399 if err != nil { 400 return 0, err 401 } 402 i -= size 403 i = encodeVarintRules(dAtA, i, uint64(size)) 404 } 405 i-- 406 dAtA[i] = 0x4a 407 } 408 } 409 if len(m.User) > 0 { 410 i -= len(m.User) 411 copy(dAtA[i:], m.User) 412 i = encodeVarintRules(dAtA, i, uint64(len(m.User))) 413 i-- 414 dAtA[i] = 0x32 415 } 416 if len(m.Rules) > 0 { 417 for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { 418 { 419 size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 420 if err != nil { 421 return 0, err 422 } 423 i -= size 424 i = encodeVarintRules(dAtA, i, uint64(size)) 425 } 426 i-- 427 dAtA[i] = 0x22 428 } 429 } 430 n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Interval, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Interval):]) 431 if err1 != nil { 432 return 0, err1 433 } 434 i -= n1 435 i = encodeVarintRules(dAtA, i, uint64(n1)) 436 i-- 437 dAtA[i] = 0x1a 438 if len(m.Namespace) > 0 { 439 i -= len(m.Namespace) 440 copy(dAtA[i:], m.Namespace) 441 i = encodeVarintRules(dAtA, i, uint64(len(m.Namespace))) 442 i-- 443 dAtA[i] = 0x12 444 } 445 if len(m.Name) > 0 { 446 i -= len(m.Name) 447 copy(dAtA[i:], m.Name) 448 i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) 449 i-- 450 dAtA[i] = 0xa 451 } 452 return len(dAtA) - i, nil 453 } 454 455 func (m *RuleDesc) Marshal() (dAtA []byte, err error) { 456 size := m.Size() 457 dAtA = make([]byte, size) 458 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 459 if err != nil { 460 return nil, err 461 } 462 return dAtA[:n], nil 463 } 464 465 func (m *RuleDesc) MarshalTo(dAtA []byte) (int, error) { 466 size := m.Size() 467 return m.MarshalToSizedBuffer(dAtA[:size]) 468 } 469 470 func (m *RuleDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { 471 i := len(dAtA) 472 _ = i 473 var l int 474 _ = l 475 if len(m.Annotations) > 0 { 476 for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { 477 { 478 size := m.Annotations[iNdEx].Size() 479 i -= size 480 if _, err := m.Annotations[iNdEx].MarshalTo(dAtA[i:]); err != nil { 481 return 0, err 482 } 483 i = encodeVarintRules(dAtA, i, uint64(size)) 484 } 485 i-- 486 dAtA[i] = 0x32 487 } 488 } 489 if len(m.Labels) > 0 { 490 for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { 491 { 492 size := m.Labels[iNdEx].Size() 493 i -= size 494 if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { 495 return 0, err 496 } 497 i = encodeVarintRules(dAtA, i, uint64(size)) 498 } 499 i-- 500 dAtA[i] = 0x2a 501 } 502 } 503 n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.For, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.For):]) 504 if err2 != nil { 505 return 0, err2 506 } 507 i -= n2 508 i = encodeVarintRules(dAtA, i, uint64(n2)) 509 i-- 510 dAtA[i] = 0x22 511 if len(m.Alert) > 0 { 512 i -= len(m.Alert) 513 copy(dAtA[i:], m.Alert) 514 i = encodeVarintRules(dAtA, i, uint64(len(m.Alert))) 515 i-- 516 dAtA[i] = 0x1a 517 } 518 if len(m.Record) > 0 { 519 i -= len(m.Record) 520 copy(dAtA[i:], m.Record) 521 i = encodeVarintRules(dAtA, i, uint64(len(m.Record))) 522 i-- 523 dAtA[i] = 0x12 524 } 525 if len(m.Expr) > 0 { 526 i -= len(m.Expr) 527 copy(dAtA[i:], m.Expr) 528 i = encodeVarintRules(dAtA, i, uint64(len(m.Expr))) 529 i-- 530 dAtA[i] = 0xa 531 } 532 return len(dAtA) - i, nil 533 } 534 535 func encodeVarintRules(dAtA []byte, offset int, v uint64) int { 536 offset -= sovRules(v) 537 base := offset 538 for v >= 1<<7 { 539 dAtA[offset] = uint8(v&0x7f | 0x80) 540 v >>= 7 541 offset++ 542 } 543 dAtA[offset] = uint8(v) 544 return base 545 } 546 func (m *RuleGroupDesc) Size() (n int) { 547 if m == nil { 548 return 0 549 } 550 var l int 551 _ = l 552 l = len(m.Name) 553 if l > 0 { 554 n += 1 + l + sovRules(uint64(l)) 555 } 556 l = len(m.Namespace) 557 if l > 0 { 558 n += 1 + l + sovRules(uint64(l)) 559 } 560 l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Interval) 561 n += 1 + l + sovRules(uint64(l)) 562 if len(m.Rules) > 0 { 563 for _, e := range m.Rules { 564 l = e.Size() 565 n += 1 + l + sovRules(uint64(l)) 566 } 567 } 568 l = len(m.User) 569 if l > 0 { 570 n += 1 + l + sovRules(uint64(l)) 571 } 572 if len(m.Options) > 0 { 573 for _, e := range m.Options { 574 l = e.Size() 575 n += 1 + l + sovRules(uint64(l)) 576 } 577 } 578 return n 579 } 580 581 func (m *RuleDesc) Size() (n int) { 582 if m == nil { 583 return 0 584 } 585 var l int 586 _ = l 587 l = len(m.Expr) 588 if l > 0 { 589 n += 1 + l + sovRules(uint64(l)) 590 } 591 l = len(m.Record) 592 if l > 0 { 593 n += 1 + l + sovRules(uint64(l)) 594 } 595 l = len(m.Alert) 596 if l > 0 { 597 n += 1 + l + sovRules(uint64(l)) 598 } 599 l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.For) 600 n += 1 + l + sovRules(uint64(l)) 601 if len(m.Labels) > 0 { 602 for _, e := range m.Labels { 603 l = e.Size() 604 n += 1 + l + sovRules(uint64(l)) 605 } 606 } 607 if len(m.Annotations) > 0 { 608 for _, e := range m.Annotations { 609 l = e.Size() 610 n += 1 + l + sovRules(uint64(l)) 611 } 612 } 613 return n 614 } 615 616 func sovRules(x uint64) (n int) { 617 return (math_bits.Len64(x|1) + 6) / 7 618 } 619 func sozRules(x uint64) (n int) { 620 return sovRules(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 621 } 622 func (this *RuleGroupDesc) String() string { 623 if this == nil { 624 return "nil" 625 } 626 repeatedStringForRules := "[]*RuleDesc{" 627 for _, f := range this.Rules { 628 repeatedStringForRules += strings.Replace(f.String(), "RuleDesc", "RuleDesc", 1) + "," 629 } 630 repeatedStringForRules += "}" 631 repeatedStringForOptions := "[]*Any{" 632 for _, f := range this.Options { 633 repeatedStringForOptions += strings.Replace(fmt.Sprintf("%v", f), "Any", "types.Any", 1) + "," 634 } 635 repeatedStringForOptions += "}" 636 s := strings.Join([]string{`&RuleGroupDesc{`, 637 `Name:` + fmt.Sprintf("%v", this.Name) + `,`, 638 `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, 639 `Interval:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Interval), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, 640 `Rules:` + repeatedStringForRules + `,`, 641 `User:` + fmt.Sprintf("%v", this.User) + `,`, 642 `Options:` + repeatedStringForOptions + `,`, 643 `}`, 644 }, "") 645 return s 646 } 647 func (this *RuleDesc) String() string { 648 if this == nil { 649 return "nil" 650 } 651 s := strings.Join([]string{`&RuleDesc{`, 652 `Expr:` + fmt.Sprintf("%v", this.Expr) + `,`, 653 `Record:` + fmt.Sprintf("%v", this.Record) + `,`, 654 `Alert:` + fmt.Sprintf("%v", this.Alert) + `,`, 655 `For:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.For), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, 656 `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, 657 `Annotations:` + fmt.Sprintf("%v", this.Annotations) + `,`, 658 `}`, 659 }, "") 660 return s 661 } 662 func valueToStringRules(v interface{}) string { 663 rv := reflect.ValueOf(v) 664 if rv.IsNil() { 665 return "nil" 666 } 667 pv := reflect.Indirect(rv).Interface() 668 return fmt.Sprintf("*%v", pv) 669 } 670 func (m *RuleGroupDesc) Unmarshal(dAtA []byte) error { 671 l := len(dAtA) 672 iNdEx := 0 673 for iNdEx < l { 674 preIndex := iNdEx 675 var wire uint64 676 for shift := uint(0); ; shift += 7 { 677 if shift >= 64 { 678 return ErrIntOverflowRules 679 } 680 if iNdEx >= l { 681 return io.ErrUnexpectedEOF 682 } 683 b := dAtA[iNdEx] 684 iNdEx++ 685 wire |= uint64(b&0x7F) << shift 686 if b < 0x80 { 687 break 688 } 689 } 690 fieldNum := int32(wire >> 3) 691 wireType := int(wire & 0x7) 692 if wireType == 4 { 693 return fmt.Errorf("proto: RuleGroupDesc: wiretype end group for non-group") 694 } 695 if fieldNum <= 0 { 696 return fmt.Errorf("proto: RuleGroupDesc: illegal tag %d (wire type %d)", fieldNum, wire) 697 } 698 switch fieldNum { 699 case 1: 700 if wireType != 2 { 701 return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) 702 } 703 var stringLen uint64 704 for shift := uint(0); ; shift += 7 { 705 if shift >= 64 { 706 return ErrIntOverflowRules 707 } 708 if iNdEx >= l { 709 return io.ErrUnexpectedEOF 710 } 711 b := dAtA[iNdEx] 712 iNdEx++ 713 stringLen |= uint64(b&0x7F) << shift 714 if b < 0x80 { 715 break 716 } 717 } 718 intStringLen := int(stringLen) 719 if intStringLen < 0 { 720 return ErrInvalidLengthRules 721 } 722 postIndex := iNdEx + intStringLen 723 if postIndex < 0 { 724 return ErrInvalidLengthRules 725 } 726 if postIndex > l { 727 return io.ErrUnexpectedEOF 728 } 729 m.Name = string(dAtA[iNdEx:postIndex]) 730 iNdEx = postIndex 731 case 2: 732 if wireType != 2 { 733 return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) 734 } 735 var stringLen uint64 736 for shift := uint(0); ; shift += 7 { 737 if shift >= 64 { 738 return ErrIntOverflowRules 739 } 740 if iNdEx >= l { 741 return io.ErrUnexpectedEOF 742 } 743 b := dAtA[iNdEx] 744 iNdEx++ 745 stringLen |= uint64(b&0x7F) << shift 746 if b < 0x80 { 747 break 748 } 749 } 750 intStringLen := int(stringLen) 751 if intStringLen < 0 { 752 return ErrInvalidLengthRules 753 } 754 postIndex := iNdEx + intStringLen 755 if postIndex < 0 { 756 return ErrInvalidLengthRules 757 } 758 if postIndex > l { 759 return io.ErrUnexpectedEOF 760 } 761 m.Namespace = string(dAtA[iNdEx:postIndex]) 762 iNdEx = postIndex 763 case 3: 764 if wireType != 2 { 765 return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) 766 } 767 var msglen int 768 for shift := uint(0); ; shift += 7 { 769 if shift >= 64 { 770 return ErrIntOverflowRules 771 } 772 if iNdEx >= l { 773 return io.ErrUnexpectedEOF 774 } 775 b := dAtA[iNdEx] 776 iNdEx++ 777 msglen |= int(b&0x7F) << shift 778 if b < 0x80 { 779 break 780 } 781 } 782 if msglen < 0 { 783 return ErrInvalidLengthRules 784 } 785 postIndex := iNdEx + msglen 786 if postIndex < 0 { 787 return ErrInvalidLengthRules 788 } 789 if postIndex > l { 790 return io.ErrUnexpectedEOF 791 } 792 if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Interval, dAtA[iNdEx:postIndex]); err != nil { 793 return err 794 } 795 iNdEx = postIndex 796 case 4: 797 if wireType != 2 { 798 return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) 799 } 800 var msglen int 801 for shift := uint(0); ; shift += 7 { 802 if shift >= 64 { 803 return ErrIntOverflowRules 804 } 805 if iNdEx >= l { 806 return io.ErrUnexpectedEOF 807 } 808 b := dAtA[iNdEx] 809 iNdEx++ 810 msglen |= int(b&0x7F) << shift 811 if b < 0x80 { 812 break 813 } 814 } 815 if msglen < 0 { 816 return ErrInvalidLengthRules 817 } 818 postIndex := iNdEx + msglen 819 if postIndex < 0 { 820 return ErrInvalidLengthRules 821 } 822 if postIndex > l { 823 return io.ErrUnexpectedEOF 824 } 825 m.Rules = append(m.Rules, &RuleDesc{}) 826 if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 827 return err 828 } 829 iNdEx = postIndex 830 case 6: 831 if wireType != 2 { 832 return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) 833 } 834 var stringLen uint64 835 for shift := uint(0); ; shift += 7 { 836 if shift >= 64 { 837 return ErrIntOverflowRules 838 } 839 if iNdEx >= l { 840 return io.ErrUnexpectedEOF 841 } 842 b := dAtA[iNdEx] 843 iNdEx++ 844 stringLen |= uint64(b&0x7F) << shift 845 if b < 0x80 { 846 break 847 } 848 } 849 intStringLen := int(stringLen) 850 if intStringLen < 0 { 851 return ErrInvalidLengthRules 852 } 853 postIndex := iNdEx + intStringLen 854 if postIndex < 0 { 855 return ErrInvalidLengthRules 856 } 857 if postIndex > l { 858 return io.ErrUnexpectedEOF 859 } 860 m.User = string(dAtA[iNdEx:postIndex]) 861 iNdEx = postIndex 862 case 9: 863 if wireType != 2 { 864 return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) 865 } 866 var msglen int 867 for shift := uint(0); ; shift += 7 { 868 if shift >= 64 { 869 return ErrIntOverflowRules 870 } 871 if iNdEx >= l { 872 return io.ErrUnexpectedEOF 873 } 874 b := dAtA[iNdEx] 875 iNdEx++ 876 msglen |= int(b&0x7F) << shift 877 if b < 0x80 { 878 break 879 } 880 } 881 if msglen < 0 { 882 return ErrInvalidLengthRules 883 } 884 postIndex := iNdEx + msglen 885 if postIndex < 0 { 886 return ErrInvalidLengthRules 887 } 888 if postIndex > l { 889 return io.ErrUnexpectedEOF 890 } 891 m.Options = append(m.Options, &types.Any{}) 892 if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 893 return err 894 } 895 iNdEx = postIndex 896 default: 897 iNdEx = preIndex 898 skippy, err := skipRules(dAtA[iNdEx:]) 899 if err != nil { 900 return err 901 } 902 if skippy < 0 { 903 return ErrInvalidLengthRules 904 } 905 if (iNdEx + skippy) < 0 { 906 return ErrInvalidLengthRules 907 } 908 if (iNdEx + skippy) > l { 909 return io.ErrUnexpectedEOF 910 } 911 iNdEx += skippy 912 } 913 } 914 915 if iNdEx > l { 916 return io.ErrUnexpectedEOF 917 } 918 return nil 919 } 920 func (m *RuleDesc) Unmarshal(dAtA []byte) error { 921 l := len(dAtA) 922 iNdEx := 0 923 for iNdEx < l { 924 preIndex := iNdEx 925 var wire uint64 926 for shift := uint(0); ; shift += 7 { 927 if shift >= 64 { 928 return ErrIntOverflowRules 929 } 930 if iNdEx >= l { 931 return io.ErrUnexpectedEOF 932 } 933 b := dAtA[iNdEx] 934 iNdEx++ 935 wire |= uint64(b&0x7F) << shift 936 if b < 0x80 { 937 break 938 } 939 } 940 fieldNum := int32(wire >> 3) 941 wireType := int(wire & 0x7) 942 if wireType == 4 { 943 return fmt.Errorf("proto: RuleDesc: wiretype end group for non-group") 944 } 945 if fieldNum <= 0 { 946 return fmt.Errorf("proto: RuleDesc: illegal tag %d (wire type %d)", fieldNum, wire) 947 } 948 switch fieldNum { 949 case 1: 950 if wireType != 2 { 951 return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) 952 } 953 var stringLen uint64 954 for shift := uint(0); ; shift += 7 { 955 if shift >= 64 { 956 return ErrIntOverflowRules 957 } 958 if iNdEx >= l { 959 return io.ErrUnexpectedEOF 960 } 961 b := dAtA[iNdEx] 962 iNdEx++ 963 stringLen |= uint64(b&0x7F) << shift 964 if b < 0x80 { 965 break 966 } 967 } 968 intStringLen := int(stringLen) 969 if intStringLen < 0 { 970 return ErrInvalidLengthRules 971 } 972 postIndex := iNdEx + intStringLen 973 if postIndex < 0 { 974 return ErrInvalidLengthRules 975 } 976 if postIndex > l { 977 return io.ErrUnexpectedEOF 978 } 979 m.Expr = string(dAtA[iNdEx:postIndex]) 980 iNdEx = postIndex 981 case 2: 982 if wireType != 2 { 983 return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) 984 } 985 var stringLen uint64 986 for shift := uint(0); ; shift += 7 { 987 if shift >= 64 { 988 return ErrIntOverflowRules 989 } 990 if iNdEx >= l { 991 return io.ErrUnexpectedEOF 992 } 993 b := dAtA[iNdEx] 994 iNdEx++ 995 stringLen |= uint64(b&0x7F) << shift 996 if b < 0x80 { 997 break 998 } 999 } 1000 intStringLen := int(stringLen) 1001 if intStringLen < 0 { 1002 return ErrInvalidLengthRules 1003 } 1004 postIndex := iNdEx + intStringLen 1005 if postIndex < 0 { 1006 return ErrInvalidLengthRules 1007 } 1008 if postIndex > l { 1009 return io.ErrUnexpectedEOF 1010 } 1011 m.Record = string(dAtA[iNdEx:postIndex]) 1012 iNdEx = postIndex 1013 case 3: 1014 if wireType != 2 { 1015 return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) 1016 } 1017 var stringLen uint64 1018 for shift := uint(0); ; shift += 7 { 1019 if shift >= 64 { 1020 return ErrIntOverflowRules 1021 } 1022 if iNdEx >= l { 1023 return io.ErrUnexpectedEOF 1024 } 1025 b := dAtA[iNdEx] 1026 iNdEx++ 1027 stringLen |= uint64(b&0x7F) << shift 1028 if b < 0x80 { 1029 break 1030 } 1031 } 1032 intStringLen := int(stringLen) 1033 if intStringLen < 0 { 1034 return ErrInvalidLengthRules 1035 } 1036 postIndex := iNdEx + intStringLen 1037 if postIndex < 0 { 1038 return ErrInvalidLengthRules 1039 } 1040 if postIndex > l { 1041 return io.ErrUnexpectedEOF 1042 } 1043 m.Alert = string(dAtA[iNdEx:postIndex]) 1044 iNdEx = postIndex 1045 case 4: 1046 if wireType != 2 { 1047 return fmt.Errorf("proto: wrong wireType = %d for field For", wireType) 1048 } 1049 var msglen int 1050 for shift := uint(0); ; shift += 7 { 1051 if shift >= 64 { 1052 return ErrIntOverflowRules 1053 } 1054 if iNdEx >= l { 1055 return io.ErrUnexpectedEOF 1056 } 1057 b := dAtA[iNdEx] 1058 iNdEx++ 1059 msglen |= int(b&0x7F) << shift 1060 if b < 0x80 { 1061 break 1062 } 1063 } 1064 if msglen < 0 { 1065 return ErrInvalidLengthRules 1066 } 1067 postIndex := iNdEx + msglen 1068 if postIndex < 0 { 1069 return ErrInvalidLengthRules 1070 } 1071 if postIndex > l { 1072 return io.ErrUnexpectedEOF 1073 } 1074 if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.For, dAtA[iNdEx:postIndex]); err != nil { 1075 return err 1076 } 1077 iNdEx = postIndex 1078 case 5: 1079 if wireType != 2 { 1080 return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) 1081 } 1082 var msglen int 1083 for shift := uint(0); ; shift += 7 { 1084 if shift >= 64 { 1085 return ErrIntOverflowRules 1086 } 1087 if iNdEx >= l { 1088 return io.ErrUnexpectedEOF 1089 } 1090 b := dAtA[iNdEx] 1091 iNdEx++ 1092 msglen |= int(b&0x7F) << shift 1093 if b < 0x80 { 1094 break 1095 } 1096 } 1097 if msglen < 0 { 1098 return ErrInvalidLengthRules 1099 } 1100 postIndex := iNdEx + msglen 1101 if postIndex < 0 { 1102 return ErrInvalidLengthRules 1103 } 1104 if postIndex > l { 1105 return io.ErrUnexpectedEOF 1106 } 1107 m.Labels = append(m.Labels, github_com_grafana_loki_pkg_logproto.LabelAdapter{}) 1108 if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1109 return err 1110 } 1111 iNdEx = postIndex 1112 case 6: 1113 if wireType != 2 { 1114 return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) 1115 } 1116 var msglen int 1117 for shift := uint(0); ; shift += 7 { 1118 if shift >= 64 { 1119 return ErrIntOverflowRules 1120 } 1121 if iNdEx >= l { 1122 return io.ErrUnexpectedEOF 1123 } 1124 b := dAtA[iNdEx] 1125 iNdEx++ 1126 msglen |= int(b&0x7F) << shift 1127 if b < 0x80 { 1128 break 1129 } 1130 } 1131 if msglen < 0 { 1132 return ErrInvalidLengthRules 1133 } 1134 postIndex := iNdEx + msglen 1135 if postIndex < 0 { 1136 return ErrInvalidLengthRules 1137 } 1138 if postIndex > l { 1139 return io.ErrUnexpectedEOF 1140 } 1141 m.Annotations = append(m.Annotations, github_com_grafana_loki_pkg_logproto.LabelAdapter{}) 1142 if err := m.Annotations[len(m.Annotations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1143 return err 1144 } 1145 iNdEx = postIndex 1146 default: 1147 iNdEx = preIndex 1148 skippy, err := skipRules(dAtA[iNdEx:]) 1149 if err != nil { 1150 return err 1151 } 1152 if skippy < 0 { 1153 return ErrInvalidLengthRules 1154 } 1155 if (iNdEx + skippy) < 0 { 1156 return ErrInvalidLengthRules 1157 } 1158 if (iNdEx + skippy) > l { 1159 return io.ErrUnexpectedEOF 1160 } 1161 iNdEx += skippy 1162 } 1163 } 1164 1165 if iNdEx > l { 1166 return io.ErrUnexpectedEOF 1167 } 1168 return nil 1169 } 1170 func skipRules(dAtA []byte) (n int, err error) { 1171 l := len(dAtA) 1172 iNdEx := 0 1173 for iNdEx < l { 1174 var wire uint64 1175 for shift := uint(0); ; shift += 7 { 1176 if shift >= 64 { 1177 return 0, ErrIntOverflowRules 1178 } 1179 if iNdEx >= l { 1180 return 0, io.ErrUnexpectedEOF 1181 } 1182 b := dAtA[iNdEx] 1183 iNdEx++ 1184 wire |= (uint64(b) & 0x7F) << shift 1185 if b < 0x80 { 1186 break 1187 } 1188 } 1189 wireType := int(wire & 0x7) 1190 switch wireType { 1191 case 0: 1192 for shift := uint(0); ; shift += 7 { 1193 if shift >= 64 { 1194 return 0, ErrIntOverflowRules 1195 } 1196 if iNdEx >= l { 1197 return 0, io.ErrUnexpectedEOF 1198 } 1199 iNdEx++ 1200 if dAtA[iNdEx-1] < 0x80 { 1201 break 1202 } 1203 } 1204 return iNdEx, nil 1205 case 1: 1206 iNdEx += 8 1207 return iNdEx, nil 1208 case 2: 1209 var length int 1210 for shift := uint(0); ; shift += 7 { 1211 if shift >= 64 { 1212 return 0, ErrIntOverflowRules 1213 } 1214 if iNdEx >= l { 1215 return 0, io.ErrUnexpectedEOF 1216 } 1217 b := dAtA[iNdEx] 1218 iNdEx++ 1219 length |= (int(b) & 0x7F) << shift 1220 if b < 0x80 { 1221 break 1222 } 1223 } 1224 if length < 0 { 1225 return 0, ErrInvalidLengthRules 1226 } 1227 iNdEx += length 1228 if iNdEx < 0 { 1229 return 0, ErrInvalidLengthRules 1230 } 1231 return iNdEx, nil 1232 case 3: 1233 for { 1234 var innerWire uint64 1235 var start int = iNdEx 1236 for shift := uint(0); ; shift += 7 { 1237 if shift >= 64 { 1238 return 0, ErrIntOverflowRules 1239 } 1240 if iNdEx >= l { 1241 return 0, io.ErrUnexpectedEOF 1242 } 1243 b := dAtA[iNdEx] 1244 iNdEx++ 1245 innerWire |= (uint64(b) & 0x7F) << shift 1246 if b < 0x80 { 1247 break 1248 } 1249 } 1250 innerWireType := int(innerWire & 0x7) 1251 if innerWireType == 4 { 1252 break 1253 } 1254 next, err := skipRules(dAtA[start:]) 1255 if err != nil { 1256 return 0, err 1257 } 1258 iNdEx = start + next 1259 if iNdEx < 0 { 1260 return 0, ErrInvalidLengthRules 1261 } 1262 } 1263 return iNdEx, nil 1264 case 4: 1265 return iNdEx, nil 1266 case 5: 1267 iNdEx += 4 1268 return iNdEx, nil 1269 default: 1270 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 1271 } 1272 } 1273 panic("unreachable") 1274 } 1275 1276 var ( 1277 ErrInvalidLengthRules = fmt.Errorf("proto: negative length found during unmarshaling") 1278 ErrIntOverflowRules = fmt.Errorf("proto: integer overflow") 1279 )