user.proto 2.3 KB

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