syntax = "proto3";

import "github.com/gogo/protobuf@v1.3.1/gogoproto/gogo.proto";
import "github.com/sensu/sensu-go/api/core/v2/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;

// Entity is the Entity supplying the event. The default Entity for any
// Event is the running Agent process--if the Event is sent by an Agent.
message Entity {
  option (gogoproto.face) = true;
  option (gogoproto.goproto_getters) = false;

  string entity_class = 1 [ (gogoproto.jsontag) = "entity_class" ];
  System system = 3 [ (gogoproto.nullable) = false ];
  repeated string subscriptions = 4 [ (gogoproto.jsontag) = "subscriptions" ];
  int64 last_seen = 5 [ (gogoproto.jsontag) = "last_seen" ];
  bool deregister = 6 [ (gogoproto.jsontag) = "deregister" ];
  Deregistration deregistration = 7 [ (gogoproto.nullable) = false ];
  string user = 11;
  // ExtendedAttributes store serialized arbitrary JSON-encoded data
  bytes extended_attributes = 12 [ (gogoproto.jsontag) = "-" ];
  // Redact contains the fields to redact on the agent
  repeated string redact = 13;
  // Metadata contains the name, namespace, labels and annotations of the
  // entity
  ObjectMeta metadata = 14 [ (gogoproto.jsontag) = "metadata,omitempty", (gogoproto.embed) = true, (gogoproto.nullable) = false ];
  // SensuAgentVersion is the sensu-agent version.
  string sensu_agent_version = 15 [ (gogoproto.jsontag) = "sensu_agent_version" ];
  // KeepaliveHandlers contains a list of handlers to use for the entity's
  // keepalive events
  repeated string keepalive_handlers = 16;
}

// System contains information about the system that the Agent process
// is running on, used for additional Entity context.
message System {
  string hostname = 1;
  string os = 2 [ (gogoproto.customname) = "OS" ];
  string platform = 3;
  string platform_family = 4;
  string platform_version = 5;
  Network network = 6 [ (gogoproto.nullable) = false ];
  string arch = 7;
  int32 arm_version = 8 [ (gogoproto.customname) = "ARMVersion" ];

  // LibCType indicates the type of libc the agent has access to (glibc, musl,
  // etc)
  string LibCType = 9 [ (gogoproto.jsontag) = "libc_type" ];

  // VMSystem indicates the VM system of the agent (kvm, vbox, etc)
  string VMSystem = 10 [ (gogoproto.jsontag) = "vm_system" ];

  // VMRole indicates the VM role of the agent (host/guest)
  string VMRole = 11 [ (gogoproto.jsontag) = "vm_role" ];

  // CloudProvider indicates the public cloud the agent is running on.
  string CloudProvider = 12 [ (gogoproto.jsontag) = "cloud_provider" ];

  string float_type = 13;

  // Processes contains information about the local processes on the agent.
  repeated Process Processes = 14 [ (gogoproto.jsontag) = "processes" ];
}

// Process contains information about a local process.
message Process { string name = 1 [ (gogoproto.jsontag) = "name" ]; }

// Network contains information about the system network interfaces
// that the Agent process is running on, used for additional Entity
// context.
message Network { repeated NetworkInterface interfaces = 1 [ (gogoproto.jsontag) = "interfaces", (gogoproto.nullable) = false ]; }

// NetworkInterface contains information about a system network
// interface.
message NetworkInterface {
  string name = 1;
  string mac = 2 [ (gogoproto.customname) = "MAC" ];
  repeated string addresses = 3 [ (gogoproto.jsontag) = "addresses" ];
}

// Deregistration contains configuration for Sensu entity de-registration.
message Deregistration { string handler = 1; }
