/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

syntax = "proto3";

option go_package = ".;protocol";

package ksandbox.v1alpha1;

// The agent runs in the pod, and serves this service to allow for complicated actions inside a container.
service Agent {
  // Execute the specified shell command
  rpc ExecuteCommand(ExecuteCommandRequest) returns (ExecuteCommandResponse);

  // TODO: Read / write filesystem
}

// Requests execution of a shell command
message ExecuteCommandRequest {
  // The command to execute
  repeated string command = 1;

  // The working directory for the command
  string working_dir = 2;

  // The environment variables to set for the command
  repeated EnvironmentVariable env = 3;
}

message EnvironmentVariable {
  string name = 1;
  string value = 2;
}

// Reports results of executing a shell command
message ExecuteCommandResponse {
    int32 exit_code = 1;

    bytes stdout = 2;
    bytes stderr = 3;
}
