syntax = "proto3";

package gitlab_com.gitlab_runner.runner_wrapper;
option go_package = "./proto";

enum Status {
  unknown = 0;
  running = 1;
  in_shutdown = 2;
  stopped = 3;
}

message CheckStatusRequest {}

message CheckStatusResponse {
  Status status = 1;
  string failureReason = 2;
}

message ShutdownCallback {
  string url = 1;
  string method = 2;
  map <string, string> headers = 3;
}

message InitGracefulShutdownRequest {
  ShutdownCallback shutdownCallback = 1;
}

message InitGracefulShutdownResponse {
  Status status = 1;
  string failureReason = 2;
}

message InitForcefulShutdownRequest {}

message InitForcefulShutdownResponse {
  Status status = 1;
  string failureReason = 2;
}

service ProcessWrapper {
  rpc CheckStatus(CheckStatusRequest) returns (CheckStatusResponse);
  rpc InitGracefulShutdown(InitGracefulShutdownRequest) returns (InitGracefulShutdownResponse);
  rpc InitForcefulShutdown(InitForcefulShutdownRequest) returns (InitForcefulShutdownResponse);
}
