user.proto 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. syntax = "proto3";
  2. package pb;
  3. import "google/api/annotations.proto";
  4. message UserListRequest {
  5. }
  6. message UserCreateRequest {
  7. string Username = 1;
  8. string Password = 2;
  9. bool NoGW = 3;
  10. uint32 HostID = 4;
  11. }
  12. message UserUpdateRequest {
  13. string Username = 1;
  14. string Password = 2;
  15. enum GWPref {
  16. NOPREF = 0;
  17. NOGW = 1;
  18. GW = 2;
  19. }
  20. GWPref gwpref = 3;
  21. uint32 HostID = 4;
  22. }
  23. message UserDeleteRequest {
  24. string Username = 1;
  25. }
  26. message UserRenewRequest {
  27. string Username = 1;
  28. }
  29. message UserGenConfigRequest {
  30. string Username = 1;
  31. }
  32. service UserService {
  33. rpc List (UserListRequest) returns (UserResponse) {
  34. option (google.api.http) = {
  35. post: "/v1/user/list"
  36. body: "*"
  37. };
  38. }
  39. rpc Create (UserCreateRequest) returns (UserResponse) {
  40. option (google.api.http) = {
  41. post: "/v1/user/create"
  42. body: "*"
  43. };
  44. }
  45. rpc Update (UserUpdateRequest) returns (UserResponse) {
  46. option (google.api.http) = {
  47. post: "/v1/user/update"
  48. body: "*"
  49. };
  50. }
  51. rpc Delete (UserDeleteRequest) returns (UserResponse) {
  52. option (google.api.http) = {
  53. post: "/v1/user/delete"
  54. body: "*"
  55. };
  56. }
  57. rpc Renew (UserRenewRequest) returns (UserResponse) {
  58. option (google.api.http) = {
  59. post: "/v1/user/renew"
  60. body: "*"
  61. };
  62. }
  63. rpc GenConfig (UserGenConfigRequest) returns (UserGenConfigResponse) {
  64. option (google.api.http) = {
  65. post: "/v1/user/genconfig"
  66. body: "*"
  67. };
  68. }
  69. }
  70. message UserResponse {
  71. message User {
  72. string Username = 1;
  73. string ServerSerialNumber = 2;
  74. string Cert = 3;
  75. string CreatedAt = 4;
  76. string IPNet = 5;
  77. bool NoGW = 6;
  78. uint32 HostID = 7;
  79. }
  80. repeated User users = 1;
  81. }
  82. message UserGenConfigResponse {
  83. string ClientConfig = 1;
  84. }