container.proto 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. syntax = "proto3";
  2. package protos;
  3. option go_package = ".";
  4. import "google/protobuf/empty.proto";
  5. service ContainerService {
  6. rpc StartContainer (google.protobuf.Empty) returns (StartContainerResponse);
  7. rpc StopContainer (StopContainerRequest) returns (StopContainerResponse);
  8. rpc RunCommand (RunCommandRequest) returns (stream RunCommandResponse);
  9. rpc FileExists (FileExistsRequest) returns (FileExistsResponse);
  10. rpc GetFile (GetFileRequest) returns (stream ReusableChunk);
  11. rpc PutFile (stream ReusableChunk) returns (PutFileResponse);
  12. rpc DownloadOss (DownloadOssRequest) returns (DownloadOssResponse);
  13. rpc UploadOss (UploadOssRequest) returns (UploadOssResponse);
  14. }
  15. message StartContainerResponse {
  16. string container_id = 1;
  17. }
  18. message StopContainerRequest {
  19. string container_id = 1;
  20. }
  21. message StopContainerResponse {
  22. string container_id = 1;
  23. optional bool success = 2;
  24. }
  25. message RunCommandRequest {
  26. string container_id = 1;
  27. repeated string command = 2;
  28. }
  29. message RunCommandResponse {
  30. string container_id = 1;
  31. int32 exit_code = 2;
  32. optional string msg = 3;
  33. }
  34. message FileExistsRequest {
  35. string container_id = 1;
  36. string path = 2;
  37. }
  38. message FileExistsResponse {
  39. string container_id = 1;
  40. optional bool exists = 2;
  41. }
  42. message GetFileRequest{
  43. string container_id = 1;
  44. string path = 2;
  45. }
  46. message PutFileResponse {
  47. string container_id = 1;
  48. optional bool success = 2;
  49. }
  50. message ReusableChunk {
  51. string container_id = 1;
  52. optional string path = 2;
  53. optional int64 offset = 3;
  54. optional bytes payload = 4;
  55. optional string sha256sum = 5;
  56. }
  57. message DownloadOssRequest {
  58. string container_id = 1;
  59. string bucket_name = 2;
  60. string object_key = 3;
  61. }
  62. message DownloadOssResponse {
  63. string container_id = 1;
  64. string save_path = 2;
  65. }
  66. message UploadOssRequest {
  67. string container_id = 1;
  68. string bucket_name = 2;
  69. string object_key = 3;
  70. string file_path = 4;
  71. string media_type = 5;
  72. }
  73. message UploadOssResponse {
  74. string container_id = 1;
  75. string object_key = 2;
  76. }