github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/ruler/rulespb/rules.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: rules.proto 3 4 package rulespb 5 6 import ( 7 fmt "fmt" 8 _ "github.com/cortexproject/cortex/pkg/cortexpb" 9 github_com_cortexproject_cortex_pkg_cortexpb "github.com/cortexproject/cortex/pkg/cortexpb" 10 _ "github.com/gogo/protobuf/gogoproto" 11 proto "github.com/gogo/protobuf/proto" 12 github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" 13 types "github.com/gogo/protobuf/types" 14 _ "github.com/golang/protobuf/ptypes/duration" 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 cortex 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 Cortex 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_8e722d3e922f0937, []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_cortexproject_cortex_pkg_cortexpb.LabelAdapter `protobuf:"bytes,5,rep,name=labels,proto3,customtype=github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter" json:"labels"` 130 Annotations []github_com_cortexproject_cortex_pkg_cortexpb.LabelAdapter `protobuf:"bytes,6,rep,name=annotations,proto3,customtype=github.com/cortexproject/cortex/pkg/cortexpb.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_8e722d3e922f0937, []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("rules.proto", fileDescriptor_8e722d3e922f0937) } 199 200 var fileDescriptor_8e722d3e922f0937 = []byte{ 201 // 476 bytes of a gzipped FileDescriptorProto 202 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0x3f, 0x6f, 0xd3, 0x40, 203 0x1c, 0xf5, 0x35, 0x8e, 0x63, 0x5f, 0x54, 0x11, 0x1d, 0x15, 0x72, 0x2b, 0x74, 0x89, 0x2a, 0x21, 204 0x65, 0xe1, 0x22, 0x15, 0x31, 0x30, 0x20, 0x94, 0xa8, 0x12, 0x52, 0xc4, 0x80, 0x3c, 0xb2, 0x9d, 205 0x9d, 0xab, 0x31, 0xb8, 0xbe, 0xd3, 0xf9, 0x8c, 0xda, 0x8d, 0x8f, 0xc0, 0xc8, 0x47, 0xe0, 0xa3, 206 0x74, 0xcc, 0x58, 0x31, 0x14, 0xe2, 0x2c, 0x8c, 0x95, 0xf8, 0x00, 0xa0, 0xfb, 0x63, 0x5a, 0xc1, 207 0x02, 0x03, 0x53, 0x7e, 0xef, 0xde, 0xbd, 0xbc, 0xf7, 0x7b, 0x67, 0x38, 0x94, 0x4d, 0xc9, 0x6a, 208 0x22, 0x24, 0x57, 0x1c, 0xf5, 0x0d, 0x38, 0x78, 0x98, 0x17, 0xea, 0x75, 0x93, 0x92, 0x8c, 0x9f, 209 0xce, 0x72, 0x9e, 0xf3, 0x99, 0x61, 0xd3, 0xe6, 0xc4, 0x20, 0x03, 0xcc, 0x64, 0x55, 0x07, 0x38, 210 0xe7, 0x3c, 0x2f, 0xd9, 0xcd, 0xad, 0x55, 0x23, 0xa9, 0x2a, 0x78, 0xe5, 0xf8, 0xfd, 0xdf, 0x79, 211 0x5a, 0x9d, 0x3b, 0xea, 0xc9, 0x2d, 0xa7, 0x8c, 0x4b, 0xc5, 0xce, 0x84, 0xe4, 0x6f, 0x58, 0xa6, 212 0x1c, 0x9a, 0x89, 0xb7, 0x79, 0x47, 0xa4, 0x6e, 0xb0, 0xd2, 0xc3, 0x1f, 0x00, 0xee, 0x26, 0x4d, 213 0xc9, 0x9e, 0x4b, 0xde, 0x88, 0x63, 0x56, 0x67, 0x08, 0x41, 0xbf, 0xa2, 0xa7, 0x2c, 0x06, 0x13, 214 0x30, 0x8d, 0x12, 0x33, 0xa3, 0xfb, 0x30, 0xd2, 0xbf, 0xb5, 0xa0, 0x19, 0x8b, 0x77, 0x0c, 0x71, 215 0x73, 0x80, 0x9e, 0xc1, 0xb0, 0xa8, 0x14, 0x93, 0xef, 0x68, 0x19, 0xf7, 0x26, 0x60, 0x3a, 0x3c, 216 0xda, 0x27, 0x36, 0x2c, 0xe9, 0xc2, 0x92, 0x63, 0xb7, 0xcc, 0x22, 0xbc, 0xb8, 0x1a, 0x7b, 0x1f, 217 0xbf, 0x8c, 0x41, 0xf2, 0x4b, 0x84, 0x1e, 0x40, 0x5b, 0x59, 0xec, 0x4f, 0x7a, 0xd3, 0xe1, 0xd1, 218 0x1d, 0x62, 0xdb, 0xd4, 0xb9, 0x74, 0xa4, 0xc4, 0xb2, 0x3a, 0x59, 0x53, 0x33, 0x19, 0x07, 0x36, 219 0x99, 0x9e, 0x11, 0x81, 0x03, 0x2e, 0xf4, 0x1f, 0xd7, 0x71, 0x64, 0xc4, 0x7b, 0x7f, 0x58, 0xcf, 220 0xab, 0xf3, 0xa4, 0xbb, 0xb4, 0xf4, 0xc3, 0xfe, 0x28, 0x58, 0xfa, 0xe1, 0x60, 0x14, 0x2e, 0xfd, 221 0x30, 0x1c, 0x45, 0x87, 0xdf, 0x77, 0x60, 0xd8, 0x39, 0x69, 0x0b, 0x5d, 0x5e, 0xb7, 0xbc, 0x9e, 222 0xd1, 0x3d, 0x18, 0x48, 0x96, 0x71, 0xb9, 0x72, 0x9b, 0x3b, 0x84, 0xf6, 0x60, 0x9f, 0x96, 0x4c, 223 0x2a, 0xb3, 0x73, 0x94, 0x58, 0x80, 0x1e, 0xc3, 0xde, 0x09, 0x97, 0xb1, 0xff, 0xf7, 0x3d, 0xe8, 224 0xfb, 0xa8, 0x82, 0x41, 0x49, 0x53, 0x56, 0xd6, 0x71, 0xdf, 0xac, 0x71, 0x97, 0x74, 0xef, 0x45, 225 0x5e, 0xe8, 0xf3, 0x97, 0xb4, 0x90, 0x8b, 0xb9, 0xd6, 0x7c, 0xbe, 0x1a, 0xff, 0xd3, 0x7b, 0x5b, 226 0xfd, 0x7c, 0x45, 0x85, 0x62, 0x32, 0x71, 0x2e, 0xe8, 0x0c, 0x0e, 0x69, 0x55, 0x71, 0x45, 0x6d, 227 0x77, 0xc1, 0x7f, 0x35, 0xbd, 0x6d, 0x65, 0xba, 0xdf, 0x5d, 0x3c, 0x5d, 0x6f, 0xb0, 0x77, 0xb9, 228 0xc1, 0xde, 0xf5, 0x06, 0x83, 0xf7, 0x2d, 0x06, 0x9f, 0x5a, 0x0c, 0x2e, 0x5a, 0x0c, 0xd6, 0x2d, 229 0x06, 0x5f, 0x5b, 0x0c, 0xbe, 0xb5, 0xd8, 0xbb, 0x6e, 0x31, 0xf8, 0xb0, 0xc5, 0xde, 0x7a, 0x8b, 230 0xbd, 0xcb, 0x2d, 0xf6, 0x5e, 0x0d, 0xcc, 0x87, 0x20, 0xd2, 0x34, 0x30, 0x85, 0x3e, 0xfa, 0x19, 231 0x00, 0x00, 0xff, 0xff, 0xa0, 0xd3, 0x9a, 0x1a, 0x78, 0x03, 0x00, 0x00, 232 } 233 234 func (this *RuleGroupDesc) Equal(that interface{}) bool { 235 if that == nil { 236 return this == nil 237 } 238 239 that1, ok := that.(*RuleGroupDesc) 240 if !ok { 241 that2, ok := that.(RuleGroupDesc) 242 if ok { 243 that1 = &that2 244 } else { 245 return false 246 } 247 } 248 if that1 == nil { 249 return this == nil 250 } else if this == nil { 251 return false 252 } 253 if this.Name != that1.Name { 254 return false 255 } 256 if this.Namespace != that1.Namespace { 257 return false 258 } 259 if this.Interval != that1.Interval { 260 return false 261 } 262 if len(this.Rules) != len(that1.Rules) { 263 return false 264 } 265 for i := range this.Rules { 266 if !this.Rules[i].Equal(that1.Rules[i]) { 267 return false 268 } 269 } 270 if this.User != that1.User { 271 return false 272 } 273 if len(this.Options) != len(that1.Options) { 274 return false 275 } 276 for i := range this.Options { 277 if !this.Options[i].Equal(that1.Options[i]) { 278 return false 279 } 280 } 281 return true 282 } 283 func (this *RuleDesc) Equal(that interface{}) bool { 284 if that == nil { 285 return this == nil 286 } 287 288 that1, ok := that.(*RuleDesc) 289 if !ok { 290 that2, ok := that.(RuleDesc) 291 if ok { 292 that1 = &that2 293 } else { 294 return false 295 } 296 } 297 if that1 == nil { 298 return this == nil 299 } else if this == nil { 300 return false 301 } 302 if this.Expr != that1.Expr { 303 return false 304 } 305 if this.Record != that1.Record { 306 return false 307 } 308 if this.Alert != that1.Alert { 309 return false 310 } 311 if this.For != that1.For { 312 return false 313 } 314 if len(this.Labels) != len(that1.Labels) { 315 return false 316 } 317 for i := range this.Labels { 318 if !this.Labels[i].Equal(that1.Labels[i]) { 319 return false 320 } 321 } 322 if len(this.Annotations) != len(that1.Annotations) { 323 return false 324 } 325 for i := range this.Annotations { 326 if !this.Annotations[i].Equal(that1.Annotations[i]) { 327 return false 328 } 329 } 330 return true 331 } 332 func (this *RuleGroupDesc) GoString() string { 333 if this == nil { 334 return "nil" 335 } 336 s := make([]string, 0, 10) 337 s = append(s, "&rulespb.RuleGroupDesc{") 338 s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") 339 s = append(s, "Namespace: "+fmt.Sprintf("%#v", this.Namespace)+",\n") 340 s = append(s, "Interval: "+fmt.Sprintf("%#v", this.Interval)+",\n") 341 if this.Rules != nil { 342 s = append(s, "Rules: "+fmt.Sprintf("%#v", this.Rules)+",\n") 343 } 344 s = append(s, "User: "+fmt.Sprintf("%#v", this.User)+",\n") 345 if this.Options != nil { 346 s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") 347 } 348 s = append(s, "}") 349 return strings.Join(s, "") 350 } 351 func (this *RuleDesc) GoString() string { 352 if this == nil { 353 return "nil" 354 } 355 s := make([]string, 0, 10) 356 s = append(s, "&rulespb.RuleDesc{") 357 s = append(s, "Expr: "+fmt.Sprintf("%#v", this.Expr)+",\n") 358 s = append(s, "Record: "+fmt.Sprintf("%#v", this.Record)+",\n") 359 s = append(s, "Alert: "+fmt.Sprintf("%#v", this.Alert)+",\n") 360 s = append(s, "For: "+fmt.Sprintf("%#v", this.For)+",\n") 361 s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") 362 s = append(s, "Annotations: "+fmt.Sprintf("%#v", this.Annotations)+",\n") 363 s = append(s, "}") 364 return strings.Join(s, "") 365 } 366 func valueToGoStringRules(v interface{}, typ string) string { 367 rv := reflect.ValueOf(v) 368 if rv.IsNil() { 369 return "nil" 370 } 371 pv := reflect.Indirect(rv).Interface() 372 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 373 } 374 func (m *RuleGroupDesc) Marshal() (dAtA []byte, err error) { 375 size := m.Size() 376 dAtA = make([]byte, size) 377 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 378 if err != nil { 379 return nil, err 380 } 381 return dAtA[:n], nil 382 } 383 384 func (m *RuleGroupDesc) MarshalTo(dAtA []byte) (int, error) { 385 size := m.Size() 386 return m.MarshalToSizedBuffer(dAtA[:size]) 387 } 388 389 func (m *RuleGroupDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { 390 i := len(dAtA) 391 _ = i 392 var l int 393 _ = l 394 if len(m.Options) > 0 { 395 for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { 396 { 397 size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 398 if err != nil { 399 return 0, err 400 } 401 i -= size 402 i = encodeVarintRules(dAtA, i, uint64(size)) 403 } 404 i-- 405 dAtA[i] = 0x4a 406 } 407 } 408 if len(m.User) > 0 { 409 i -= len(m.User) 410 copy(dAtA[i:], m.User) 411 i = encodeVarintRules(dAtA, i, uint64(len(m.User))) 412 i-- 413 dAtA[i] = 0x32 414 } 415 if len(m.Rules) > 0 { 416 for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { 417 { 418 size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 419 if err != nil { 420 return 0, err 421 } 422 i -= size 423 i = encodeVarintRules(dAtA, i, uint64(size)) 424 } 425 i-- 426 dAtA[i] = 0x22 427 } 428 } 429 n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Interval, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Interval):]) 430 if err1 != nil { 431 return 0, err1 432 } 433 i -= n1 434 i = encodeVarintRules(dAtA, i, uint64(n1)) 435 i-- 436 dAtA[i] = 0x1a 437 if len(m.Namespace) > 0 { 438 i -= len(m.Namespace) 439 copy(dAtA[i:], m.Namespace) 440 i = encodeVarintRules(dAtA, i, uint64(len(m.Namespace))) 441 i-- 442 dAtA[i] = 0x12 443 } 444 if len(m.Name) > 0 { 445 i -= len(m.Name) 446 copy(dAtA[i:], m.Name) 447 i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) 448 i-- 449 dAtA[i] = 0xa 450 } 451 return len(dAtA) - i, nil 452 } 453 454 func (m *RuleDesc) Marshal() (dAtA []byte, err error) { 455 size := m.Size() 456 dAtA = make([]byte, size) 457 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 458 if err != nil { 459 return nil, err 460 } 461 return dAtA[:n], nil 462 } 463 464 func (m *RuleDesc) MarshalTo(dAtA []byte) (int, error) { 465 size := m.Size() 466 return m.MarshalToSizedBuffer(dAtA[:size]) 467 } 468 469 func (m *RuleDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) { 470 i := len(dAtA) 471 _ = i 472 var l int 473 _ = l 474 if len(m.Annotations) > 0 { 475 for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { 476 { 477 size := m.Annotations[iNdEx].Size() 478 i -= size 479 if _, err := m.Annotations[iNdEx].MarshalTo(dAtA[i:]); err != nil { 480 return 0, err 481 } 482 i = encodeVarintRules(dAtA, i, uint64(size)) 483 } 484 i-- 485 dAtA[i] = 0x32 486 } 487 } 488 if len(m.Labels) > 0 { 489 for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { 490 { 491 size := m.Labels[iNdEx].Size() 492 i -= size 493 if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { 494 return 0, err 495 } 496 i = encodeVarintRules(dAtA, i, uint64(size)) 497 } 498 i-- 499 dAtA[i] = 0x2a 500 } 501 } 502 n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.For, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.For):]) 503 if err2 != nil { 504 return 0, err2 505 } 506 i -= n2 507 i = encodeVarintRules(dAtA, i, uint64(n2)) 508 i-- 509 dAtA[i] = 0x22 510 if len(m.Alert) > 0 { 511 i -= len(m.Alert) 512 copy(dAtA[i:], m.Alert) 513 i = encodeVarintRules(dAtA, i, uint64(len(m.Alert))) 514 i-- 515 dAtA[i] = 0x1a 516 } 517 if len(m.Record) > 0 { 518 i -= len(m.Record) 519 copy(dAtA[i:], m.Record) 520 i = encodeVarintRules(dAtA, i, uint64(len(m.Record))) 521 i-- 522 dAtA[i] = 0x12 523 } 524 if len(m.Expr) > 0 { 525 i -= len(m.Expr) 526 copy(dAtA[i:], m.Expr) 527 i = encodeVarintRules(dAtA, i, uint64(len(m.Expr))) 528 i-- 529 dAtA[i] = 0xa 530 } 531 return len(dAtA) - i, nil 532 } 533 534 func encodeVarintRules(dAtA []byte, offset int, v uint64) int { 535 offset -= sovRules(v) 536 base := offset 537 for v >= 1<<7 { 538 dAtA[offset] = uint8(v&0x7f | 0x80) 539 v >>= 7 540 offset++ 541 } 542 dAtA[offset] = uint8(v) 543 return base 544 } 545 func (m *RuleGroupDesc) Size() (n int) { 546 if m == nil { 547 return 0 548 } 549 var l int 550 _ = l 551 l = len(m.Name) 552 if l > 0 { 553 n += 1 + l + sovRules(uint64(l)) 554 } 555 l = len(m.Namespace) 556 if l > 0 { 557 n += 1 + l + sovRules(uint64(l)) 558 } 559 l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Interval) 560 n += 1 + l + sovRules(uint64(l)) 561 if len(m.Rules) > 0 { 562 for _, e := range m.Rules { 563 l = e.Size() 564 n += 1 + l + sovRules(uint64(l)) 565 } 566 } 567 l = len(m.User) 568 if l > 0 { 569 n += 1 + l + sovRules(uint64(l)) 570 } 571 if len(m.Options) > 0 { 572 for _, e := range m.Options { 573 l = e.Size() 574 n += 1 + l + sovRules(uint64(l)) 575 } 576 } 577 return n 578 } 579 580 func (m *RuleDesc) Size() (n int) { 581 if m == nil { 582 return 0 583 } 584 var l int 585 _ = l 586 l = len(m.Expr) 587 if l > 0 { 588 n += 1 + l + sovRules(uint64(l)) 589 } 590 l = len(m.Record) 591 if l > 0 { 592 n += 1 + l + sovRules(uint64(l)) 593 } 594 l = len(m.Alert) 595 if l > 0 { 596 n += 1 + l + sovRules(uint64(l)) 597 } 598 l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.For) 599 n += 1 + l + sovRules(uint64(l)) 600 if len(m.Labels) > 0 { 601 for _, e := range m.Labels { 602 l = e.Size() 603 n += 1 + l + sovRules(uint64(l)) 604 } 605 } 606 if len(m.Annotations) > 0 { 607 for _, e := range m.Annotations { 608 l = e.Size() 609 n += 1 + l + sovRules(uint64(l)) 610 } 611 } 612 return n 613 } 614 615 func sovRules(x uint64) (n int) { 616 return (math_bits.Len64(x|1) + 6) / 7 617 } 618 func sozRules(x uint64) (n int) { 619 return sovRules(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 620 } 621 func (this *RuleGroupDesc) String() string { 622 if this == nil { 623 return "nil" 624 } 625 repeatedStringForRules := "[]*RuleDesc{" 626 for _, f := range this.Rules { 627 repeatedStringForRules += strings.Replace(f.String(), "RuleDesc", "RuleDesc", 1) + "," 628 } 629 repeatedStringForRules += "}" 630 repeatedStringForOptions := "[]*Any{" 631 for _, f := range this.Options { 632 repeatedStringForOptions += strings.Replace(fmt.Sprintf("%v", f), "Any", "types.Any", 1) + "," 633 } 634 repeatedStringForOptions += "}" 635 s := strings.Join([]string{`&RuleGroupDesc{`, 636 `Name:` + fmt.Sprintf("%v", this.Name) + `,`, 637 `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, 638 `Interval:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Interval), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, 639 `Rules:` + repeatedStringForRules + `,`, 640 `User:` + fmt.Sprintf("%v", this.User) + `,`, 641 `Options:` + repeatedStringForOptions + `,`, 642 `}`, 643 }, "") 644 return s 645 } 646 func (this *RuleDesc) String() string { 647 if this == nil { 648 return "nil" 649 } 650 s := strings.Join([]string{`&RuleDesc{`, 651 `Expr:` + fmt.Sprintf("%v", this.Expr) + `,`, 652 `Record:` + fmt.Sprintf("%v", this.Record) + `,`, 653 `Alert:` + fmt.Sprintf("%v", this.Alert) + `,`, 654 `For:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.For), "Duration", "duration.Duration", 1), `&`, ``, 1) + `,`, 655 `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, 656 `Annotations:` + fmt.Sprintf("%v", this.Annotations) + `,`, 657 `}`, 658 }, "") 659 return s 660 } 661 func valueToStringRules(v interface{}) string { 662 rv := reflect.ValueOf(v) 663 if rv.IsNil() { 664 return "nil" 665 } 666 pv := reflect.Indirect(rv).Interface() 667 return fmt.Sprintf("*%v", pv) 668 } 669 func (m *RuleGroupDesc) Unmarshal(dAtA []byte) error { 670 l := len(dAtA) 671 iNdEx := 0 672 for iNdEx < l { 673 preIndex := iNdEx 674 var wire uint64 675 for shift := uint(0); ; shift += 7 { 676 if shift >= 64 { 677 return ErrIntOverflowRules 678 } 679 if iNdEx >= l { 680 return io.ErrUnexpectedEOF 681 } 682 b := dAtA[iNdEx] 683 iNdEx++ 684 wire |= uint64(b&0x7F) << shift 685 if b < 0x80 { 686 break 687 } 688 } 689 fieldNum := int32(wire >> 3) 690 wireType := int(wire & 0x7) 691 if wireType == 4 { 692 return fmt.Errorf("proto: RuleGroupDesc: wiretype end group for non-group") 693 } 694 if fieldNum <= 0 { 695 return fmt.Errorf("proto: RuleGroupDesc: illegal tag %d (wire type %d)", fieldNum, wire) 696 } 697 switch fieldNum { 698 case 1: 699 if wireType != 2 { 700 return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) 701 } 702 var stringLen uint64 703 for shift := uint(0); ; shift += 7 { 704 if shift >= 64 { 705 return ErrIntOverflowRules 706 } 707 if iNdEx >= l { 708 return io.ErrUnexpectedEOF 709 } 710 b := dAtA[iNdEx] 711 iNdEx++ 712 stringLen |= uint64(b&0x7F) << shift 713 if b < 0x80 { 714 break 715 } 716 } 717 intStringLen := int(stringLen) 718 if intStringLen < 0 { 719 return ErrInvalidLengthRules 720 } 721 postIndex := iNdEx + intStringLen 722 if postIndex < 0 { 723 return ErrInvalidLengthRules 724 } 725 if postIndex > l { 726 return io.ErrUnexpectedEOF 727 } 728 m.Name = string(dAtA[iNdEx:postIndex]) 729 iNdEx = postIndex 730 case 2: 731 if wireType != 2 { 732 return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) 733 } 734 var stringLen uint64 735 for shift := uint(0); ; shift += 7 { 736 if shift >= 64 { 737 return ErrIntOverflowRules 738 } 739 if iNdEx >= l { 740 return io.ErrUnexpectedEOF 741 } 742 b := dAtA[iNdEx] 743 iNdEx++ 744 stringLen |= uint64(b&0x7F) << shift 745 if b < 0x80 { 746 break 747 } 748 } 749 intStringLen := int(stringLen) 750 if intStringLen < 0 { 751 return ErrInvalidLengthRules 752 } 753 postIndex := iNdEx + intStringLen 754 if postIndex < 0 { 755 return ErrInvalidLengthRules 756 } 757 if postIndex > l { 758 return io.ErrUnexpectedEOF 759 } 760 m.Namespace = string(dAtA[iNdEx:postIndex]) 761 iNdEx = postIndex 762 case 3: 763 if wireType != 2 { 764 return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) 765 } 766 var msglen int 767 for shift := uint(0); ; shift += 7 { 768 if shift >= 64 { 769 return ErrIntOverflowRules 770 } 771 if iNdEx >= l { 772 return io.ErrUnexpectedEOF 773 } 774 b := dAtA[iNdEx] 775 iNdEx++ 776 msglen |= int(b&0x7F) << shift 777 if b < 0x80 { 778 break 779 } 780 } 781 if msglen < 0 { 782 return ErrInvalidLengthRules 783 } 784 postIndex := iNdEx + msglen 785 if postIndex < 0 { 786 return ErrInvalidLengthRules 787 } 788 if postIndex > l { 789 return io.ErrUnexpectedEOF 790 } 791 if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Interval, dAtA[iNdEx:postIndex]); err != nil { 792 return err 793 } 794 iNdEx = postIndex 795 case 4: 796 if wireType != 2 { 797 return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) 798 } 799 var msglen int 800 for shift := uint(0); ; shift += 7 { 801 if shift >= 64 { 802 return ErrIntOverflowRules 803 } 804 if iNdEx >= l { 805 return io.ErrUnexpectedEOF 806 } 807 b := dAtA[iNdEx] 808 iNdEx++ 809 msglen |= int(b&0x7F) << shift 810 if b < 0x80 { 811 break 812 } 813 } 814 if msglen < 0 { 815 return ErrInvalidLengthRules 816 } 817 postIndex := iNdEx + msglen 818 if postIndex < 0 { 819 return ErrInvalidLengthRules 820 } 821 if postIndex > l { 822 return io.ErrUnexpectedEOF 823 } 824 m.Rules = append(m.Rules, &RuleDesc{}) 825 if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 826 return err 827 } 828 iNdEx = postIndex 829 case 6: 830 if wireType != 2 { 831 return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) 832 } 833 var stringLen uint64 834 for shift := uint(0); ; shift += 7 { 835 if shift >= 64 { 836 return ErrIntOverflowRules 837 } 838 if iNdEx >= l { 839 return io.ErrUnexpectedEOF 840 } 841 b := dAtA[iNdEx] 842 iNdEx++ 843 stringLen |= uint64(b&0x7F) << shift 844 if b < 0x80 { 845 break 846 } 847 } 848 intStringLen := int(stringLen) 849 if intStringLen < 0 { 850 return ErrInvalidLengthRules 851 } 852 postIndex := iNdEx + intStringLen 853 if postIndex < 0 { 854 return ErrInvalidLengthRules 855 } 856 if postIndex > l { 857 return io.ErrUnexpectedEOF 858 } 859 m.User = string(dAtA[iNdEx:postIndex]) 860 iNdEx = postIndex 861 case 9: 862 if wireType != 2 { 863 return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) 864 } 865 var msglen int 866 for shift := uint(0); ; shift += 7 { 867 if shift >= 64 { 868 return ErrIntOverflowRules 869 } 870 if iNdEx >= l { 871 return io.ErrUnexpectedEOF 872 } 873 b := dAtA[iNdEx] 874 iNdEx++ 875 msglen |= int(b&0x7F) << shift 876 if b < 0x80 { 877 break 878 } 879 } 880 if msglen < 0 { 881 return ErrInvalidLengthRules 882 } 883 postIndex := iNdEx + msglen 884 if postIndex < 0 { 885 return ErrInvalidLengthRules 886 } 887 if postIndex > l { 888 return io.ErrUnexpectedEOF 889 } 890 m.Options = append(m.Options, &types.Any{}) 891 if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 892 return err 893 } 894 iNdEx = postIndex 895 default: 896 iNdEx = preIndex 897 skippy, err := skipRules(dAtA[iNdEx:]) 898 if err != nil { 899 return err 900 } 901 if skippy < 0 { 902 return ErrInvalidLengthRules 903 } 904 if (iNdEx + skippy) < 0 { 905 return ErrInvalidLengthRules 906 } 907 if (iNdEx + skippy) > l { 908 return io.ErrUnexpectedEOF 909 } 910 iNdEx += skippy 911 } 912 } 913 914 if iNdEx > l { 915 return io.ErrUnexpectedEOF 916 } 917 return nil 918 } 919 func (m *RuleDesc) Unmarshal(dAtA []byte) error { 920 l := len(dAtA) 921 iNdEx := 0 922 for iNdEx < l { 923 preIndex := iNdEx 924 var wire uint64 925 for shift := uint(0); ; shift += 7 { 926 if shift >= 64 { 927 return ErrIntOverflowRules 928 } 929 if iNdEx >= l { 930 return io.ErrUnexpectedEOF 931 } 932 b := dAtA[iNdEx] 933 iNdEx++ 934 wire |= uint64(b&0x7F) << shift 935 if b < 0x80 { 936 break 937 } 938 } 939 fieldNum := int32(wire >> 3) 940 wireType := int(wire & 0x7) 941 if wireType == 4 { 942 return fmt.Errorf("proto: RuleDesc: wiretype end group for non-group") 943 } 944 if fieldNum <= 0 { 945 return fmt.Errorf("proto: RuleDesc: illegal tag %d (wire type %d)", fieldNum, wire) 946 } 947 switch fieldNum { 948 case 1: 949 if wireType != 2 { 950 return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) 951 } 952 var stringLen uint64 953 for shift := uint(0); ; shift += 7 { 954 if shift >= 64 { 955 return ErrIntOverflowRules 956 } 957 if iNdEx >= l { 958 return io.ErrUnexpectedEOF 959 } 960 b := dAtA[iNdEx] 961 iNdEx++ 962 stringLen |= uint64(b&0x7F) << shift 963 if b < 0x80 { 964 break 965 } 966 } 967 intStringLen := int(stringLen) 968 if intStringLen < 0 { 969 return ErrInvalidLengthRules 970 } 971 postIndex := iNdEx + intStringLen 972 if postIndex < 0 { 973 return ErrInvalidLengthRules 974 } 975 if postIndex > l { 976 return io.ErrUnexpectedEOF 977 } 978 m.Expr = string(dAtA[iNdEx:postIndex]) 979 iNdEx = postIndex 980 case 2: 981 if wireType != 2 { 982 return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) 983 } 984 var stringLen uint64 985 for shift := uint(0); ; shift += 7 { 986 if shift >= 64 { 987 return ErrIntOverflowRules 988 } 989 if iNdEx >= l { 990 return io.ErrUnexpectedEOF 991 } 992 b := dAtA[iNdEx] 993 iNdEx++ 994 stringLen |= uint64(b&0x7F) << shift 995 if b < 0x80 { 996 break 997 } 998 } 999 intStringLen := int(stringLen) 1000 if intStringLen < 0 { 1001 return ErrInvalidLengthRules 1002 } 1003 postIndex := iNdEx + intStringLen 1004 if postIndex < 0 { 1005 return ErrInvalidLengthRules 1006 } 1007 if postIndex > l { 1008 return io.ErrUnexpectedEOF 1009 } 1010 m.Record = string(dAtA[iNdEx:postIndex]) 1011 iNdEx = postIndex 1012 case 3: 1013 if wireType != 2 { 1014 return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) 1015 } 1016 var stringLen uint64 1017 for shift := uint(0); ; shift += 7 { 1018 if shift >= 64 { 1019 return ErrIntOverflowRules 1020 } 1021 if iNdEx >= l { 1022 return io.ErrUnexpectedEOF 1023 } 1024 b := dAtA[iNdEx] 1025 iNdEx++ 1026 stringLen |= uint64(b&0x7F) << shift 1027 if b < 0x80 { 1028 break 1029 } 1030 } 1031 intStringLen := int(stringLen) 1032 if intStringLen < 0 { 1033 return ErrInvalidLengthRules 1034 } 1035 postIndex := iNdEx + intStringLen 1036 if postIndex < 0 { 1037 return ErrInvalidLengthRules 1038 } 1039 if postIndex > l { 1040 return io.ErrUnexpectedEOF 1041 } 1042 m.Alert = string(dAtA[iNdEx:postIndex]) 1043 iNdEx = postIndex 1044 case 4: 1045 if wireType != 2 { 1046 return fmt.Errorf("proto: wrong wireType = %d for field For", wireType) 1047 } 1048 var msglen int 1049 for shift := uint(0); ; shift += 7 { 1050 if shift >= 64 { 1051 return ErrIntOverflowRules 1052 } 1053 if iNdEx >= l { 1054 return io.ErrUnexpectedEOF 1055 } 1056 b := dAtA[iNdEx] 1057 iNdEx++ 1058 msglen |= int(b&0x7F) << shift 1059 if b < 0x80 { 1060 break 1061 } 1062 } 1063 if msglen < 0 { 1064 return ErrInvalidLengthRules 1065 } 1066 postIndex := iNdEx + msglen 1067 if postIndex < 0 { 1068 return ErrInvalidLengthRules 1069 } 1070 if postIndex > l { 1071 return io.ErrUnexpectedEOF 1072 } 1073 if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.For, dAtA[iNdEx:postIndex]); err != nil { 1074 return err 1075 } 1076 iNdEx = postIndex 1077 case 5: 1078 if wireType != 2 { 1079 return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) 1080 } 1081 var msglen int 1082 for shift := uint(0); ; shift += 7 { 1083 if shift >= 64 { 1084 return ErrIntOverflowRules 1085 } 1086 if iNdEx >= l { 1087 return io.ErrUnexpectedEOF 1088 } 1089 b := dAtA[iNdEx] 1090 iNdEx++ 1091 msglen |= int(b&0x7F) << shift 1092 if b < 0x80 { 1093 break 1094 } 1095 } 1096 if msglen < 0 { 1097 return ErrInvalidLengthRules 1098 } 1099 postIndex := iNdEx + msglen 1100 if postIndex < 0 { 1101 return ErrInvalidLengthRules 1102 } 1103 if postIndex > l { 1104 return io.ErrUnexpectedEOF 1105 } 1106 m.Labels = append(m.Labels, github_com_cortexproject_cortex_pkg_cortexpb.LabelAdapter{}) 1107 if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1108 return err 1109 } 1110 iNdEx = postIndex 1111 case 6: 1112 if wireType != 2 { 1113 return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) 1114 } 1115 var msglen int 1116 for shift := uint(0); ; shift += 7 { 1117 if shift >= 64 { 1118 return ErrIntOverflowRules 1119 } 1120 if iNdEx >= l { 1121 return io.ErrUnexpectedEOF 1122 } 1123 b := dAtA[iNdEx] 1124 iNdEx++ 1125 msglen |= int(b&0x7F) << shift 1126 if b < 0x80 { 1127 break 1128 } 1129 } 1130 if msglen < 0 { 1131 return ErrInvalidLengthRules 1132 } 1133 postIndex := iNdEx + msglen 1134 if postIndex < 0 { 1135 return ErrInvalidLengthRules 1136 } 1137 if postIndex > l { 1138 return io.ErrUnexpectedEOF 1139 } 1140 m.Annotations = append(m.Annotations, github_com_cortexproject_cortex_pkg_cortexpb.LabelAdapter{}) 1141 if err := m.Annotations[len(m.Annotations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1142 return err 1143 } 1144 iNdEx = postIndex 1145 default: 1146 iNdEx = preIndex 1147 skippy, err := skipRules(dAtA[iNdEx:]) 1148 if err != nil { 1149 return err 1150 } 1151 if skippy < 0 { 1152 return ErrInvalidLengthRules 1153 } 1154 if (iNdEx + skippy) < 0 { 1155 return ErrInvalidLengthRules 1156 } 1157 if (iNdEx + skippy) > l { 1158 return io.ErrUnexpectedEOF 1159 } 1160 iNdEx += skippy 1161 } 1162 } 1163 1164 if iNdEx > l { 1165 return io.ErrUnexpectedEOF 1166 } 1167 return nil 1168 } 1169 func skipRules(dAtA []byte) (n int, err error) { 1170 l := len(dAtA) 1171 iNdEx := 0 1172 for iNdEx < l { 1173 var wire uint64 1174 for shift := uint(0); ; shift += 7 { 1175 if shift >= 64 { 1176 return 0, ErrIntOverflowRules 1177 } 1178 if iNdEx >= l { 1179 return 0, io.ErrUnexpectedEOF 1180 } 1181 b := dAtA[iNdEx] 1182 iNdEx++ 1183 wire |= (uint64(b) & 0x7F) << shift 1184 if b < 0x80 { 1185 break 1186 } 1187 } 1188 wireType := int(wire & 0x7) 1189 switch wireType { 1190 case 0: 1191 for shift := uint(0); ; shift += 7 { 1192 if shift >= 64 { 1193 return 0, ErrIntOverflowRules 1194 } 1195 if iNdEx >= l { 1196 return 0, io.ErrUnexpectedEOF 1197 } 1198 iNdEx++ 1199 if dAtA[iNdEx-1] < 0x80 { 1200 break 1201 } 1202 } 1203 return iNdEx, nil 1204 case 1: 1205 iNdEx += 8 1206 return iNdEx, nil 1207 case 2: 1208 var length int 1209 for shift := uint(0); ; shift += 7 { 1210 if shift >= 64 { 1211 return 0, ErrIntOverflowRules 1212 } 1213 if iNdEx >= l { 1214 return 0, io.ErrUnexpectedEOF 1215 } 1216 b := dAtA[iNdEx] 1217 iNdEx++ 1218 length |= (int(b) & 0x7F) << shift 1219 if b < 0x80 { 1220 break 1221 } 1222 } 1223 if length < 0 { 1224 return 0, ErrInvalidLengthRules 1225 } 1226 iNdEx += length 1227 if iNdEx < 0 { 1228 return 0, ErrInvalidLengthRules 1229 } 1230 return iNdEx, nil 1231 case 3: 1232 for { 1233 var innerWire uint64 1234 var start int = iNdEx 1235 for shift := uint(0); ; shift += 7 { 1236 if shift >= 64 { 1237 return 0, ErrIntOverflowRules 1238 } 1239 if iNdEx >= l { 1240 return 0, io.ErrUnexpectedEOF 1241 } 1242 b := dAtA[iNdEx] 1243 iNdEx++ 1244 innerWire |= (uint64(b) & 0x7F) << shift 1245 if b < 0x80 { 1246 break 1247 } 1248 } 1249 innerWireType := int(innerWire & 0x7) 1250 if innerWireType == 4 { 1251 break 1252 } 1253 next, err := skipRules(dAtA[start:]) 1254 if err != nil { 1255 return 0, err 1256 } 1257 iNdEx = start + next 1258 if iNdEx < 0 { 1259 return 0, ErrInvalidLengthRules 1260 } 1261 } 1262 return iNdEx, nil 1263 case 4: 1264 return iNdEx, nil 1265 case 5: 1266 iNdEx += 4 1267 return iNdEx, nil 1268 default: 1269 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 1270 } 1271 } 1272 panic("unreachable") 1273 } 1274 1275 var ( 1276 ErrInvalidLengthRules = fmt.Errorf("proto: negative length found during unmarshaling") 1277 ErrIntOverflowRules = fmt.Errorf("proto: integer overflow") 1278 )