syntax = "proto3";

// If you make any changes make sure you run: make regenerate-proto

package gitlab.agent.agent_registrar.rpc;

option go_package = "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v18/internal/module/agent_registrar/rpc";

import "pkg/entity/entity.proto";
import "buf/validate/validate.proto";

message RegisterRequest {
  oneof meta {
    option (buf.validate.oneof).required = true;

    entity.AgentkMeta agentk_meta = 1;
    entity.AgentwMeta agentw_meta = 3;
  }
  // Uniquely identifies a particular agent process.
  // Randomly generated when agent process starts up.
  int64 instance_id = 2;
}

message RegisterResponse {
}

message UnregisterRequest {
  oneof meta {
    option (buf.validate.oneof).required = true;

    entity.AgentkMeta agentk_meta = 1;
    entity.AgentwMeta agentw_meta = 3;
  }

  // Uniquely identifies a particular agent process.
  // Randomly generated when agent process starts up.
  int64 instance_id = 2;
}

message UnregisterResponse {
}

service AgentRegistrar {
  // Register a new agent.
  rpc Register (RegisterRequest) returns (RegisterResponse) {
    option idempotency_level = IDEMPOTENT;
  }
  rpc Unregister (UnregisterRequest) returns (UnregisterResponse) {
    option idempotency_level = IDEMPOTENT;
  }
}
