syntax = "proto3";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "time_window.proto";
import "meta.proto";

package sensu.core.v2;

option go_package = "v2";
option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.testgen_all) = true;

// EventFilter is a filter specification.
message EventFilter {
  option (gogoproto.face) = true;
  option (gogoproto.goproto_getters) = false;

  // Metadata contains the name, namespace, labels and annotations of the filter
  ObjectMeta metadata = 1 [(gogoproto.jsontag) = "metadata,omitempty", (gogoproto.embed) = true, (gogoproto.nullable) = false];

  // Action specifies to allow/deny events to continue through the pipeline
  string action = 2;

  // Expressions is an array of boolean expressions that are &&'d together
  // to determine if the event matches this filter.
  repeated string expressions = 3 [(gogoproto.jsontag) = "expressions"];

  // When indicates a TimeWindowWhen that a filter uses to filter by days & times
  TimeWindowWhen when = 6;

  // Runtime assets are Sensu assets that contain javascript libraries. They
  // are evaluated within the execution context.
  repeated string runtime_assets = 8 [(gogoproto.jsontag) = "runtime_assets"];
}
