1
0

user.proto 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 no_gw = 3;
  10. uint32 host_id = 4;
  11. bool is_admin = 5;
  12. }
  13. message UserUpdateRequest {
  14. string username = 1;
  15. string password = 2;
  16. enum GWPref {
  17. NOPREF = 0;
  18. NOGW = 1;
  19. GW = 2;
  20. }
  21. GWPref gwpref = 3;
  22. uint32 host_id = 4;
  23. enum StaticPref {
  24. NOPREFSTATIC = 0;
  25. NOSTATIC = 1;
  26. STATIC = 2;
  27. }
  28. StaticPref static_pref = 5;
  29. enum AdminPref {
  30. NOPREFADMIN = 0;
  31. NOADMIN = 1;
  32. ADMIN = 2;
  33. }
  34. AdminPref admin_pref = 6;
  35. }
  36. message UserDeleteRequest {
  37. string username = 1;
  38. }
  39. message UserRenewRequest {
  40. string username = 1;
  41. }
  42. message UserGenConfigRequest {
  43. string username = 1;
  44. }
  45. service UserService {
  46. rpc List (UserListRequest) returns (UserResponse) {
  47. option (google.api.http) = {
  48. get: "/api/v1/user/list"
  49. //body: "*"
  50. };
  51. }
  52. rpc Create (UserCreateRequest) returns (UserResponse) {
  53. option (google.api.http) = {
  54. post: "/api/v1/user/create"
  55. body: "*"
  56. };
  57. }
  58. rpc Update (UserUpdateRequest) returns (UserResponse) {
  59. option (google.api.http) = {
  60. post: "/api/v1/user/update"
  61. body: "*"
  62. };
  63. }
  64. rpc Delete (UserDeleteRequest) returns (UserResponse) {
  65. option (google.api.http) = {
  66. post: "/api/v1/user/delete"
  67. body: "*"
  68. };
  69. }
  70. rpc Renew (UserRenewRequest) returns (UserResponse) {
  71. option (google.api.http) = {
  72. post: "/api/v1/user/renew"
  73. body: "*"
  74. };
  75. }
  76. rpc GenConfig (UserGenConfigRequest) returns (UserGenConfigResponse) {
  77. option (google.api.http) = {
  78. post: "/api/v1/user/genconfig"
  79. body: "*"
  80. };
  81. }
  82. }
  83. message UserResponse {
  84. message User {
  85. string username = 1;
  86. string server_serial_number = 2;
  87. string cert = 3;
  88. string created_at = 4;
  89. string ip_net = 5;
  90. bool no_gw = 6;
  91. uint32 host_id = 7;
  92. bool is_admin = 8;
  93. }
  94. repeated User users = 1;
  95. }
  96. message UserGenConfigResponse {
  97. string client_config = 1;
  98. }