
syntax = "proto3";

package rules;

option go_package = "rulespb";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/any.proto";
import "github.com/cortexproject/cortex/pkg/cortexpb/cortex.proto";

option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;

// RuleGroupDesc is a proto representation of a cortex rule group.
message RuleGroupDesc {
  reserved 5, 7, 8;
  string name = 1;
  string namespace = 2;
  google.protobuf.Duration interval = 3
      [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
  repeated RuleDesc rules = 4;
  string user = 6;
  // The options field can be used to extend Cortex Ruler functionality without
  // having to repeatedly redefine the proto description. It can also be leveraged
  // to create custom `ManagerOpts` based on rule configs which can then be passed
  // to the Prometheus Manager.
  repeated google.protobuf.Any options = 9;
}

// RuleDesc is a proto representation of a Prometheus Rule
message RuleDesc {
  reserved 7 to 12;
  string expr = 1;
  string record = 2;
  string alert = 3;
  google.protobuf.Duration for = 4 [(gogoproto.nullable) = false,(gogoproto.stdduration) = true];
  repeated cortexpb.LabelPair labels = 5 [
    (gogoproto.nullable) = false,
    (gogoproto.customtype) = "github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter"
  ];
  repeated cortexpb.LabelPair annotations = 6 [
    (gogoproto.nullable) = false,
    (gogoproto.customtype) = "github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter"
  ];
}