user.proto 2.3 KB

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