olivetin.proto 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. syntax = "proto3";
  2. package olivetin.api.v1;
  3. option go_package = "github.com/OliveTin/OliveTin/gen/olivetin/api/v1;apiv1";
  4. message Action {
  5. string binding_id = 1;
  6. string title = 2;
  7. string icon = 3;
  8. bool can_exec = 4;
  9. repeated ActionArgument arguments = 5;
  10. string popup_on_start = 6;
  11. int32 order = 7;
  12. int32 timeout = 8;
  13. string datetime_rate_limit_expires = 9; // Datetime when rate limit expires (empty string if not rate limited), format: "2006-01-02 15:04:05"
  14. bool exec_on_startup = 10;
  15. repeated string exec_on_cron = 11;
  16. repeated string exec_on_file_created_in_dir = 12;
  17. repeated string exec_on_file_changed_in_dir = 13;
  18. string exec_on_calendar_file = 14;
  19. repeated ActionWebhookExecHint exec_on_webhooks = 15;
  20. }
  21. message ActionWebhookExecHint {
  22. string template = 1;
  23. string match_path = 2;
  24. map<string, string> match_headers = 3;
  25. map<string, string> match_query = 4;
  26. }
  27. message ActionArgument {
  28. string name = 1;
  29. string title = 2;
  30. string type = 3;
  31. string default_value = 4;
  32. repeated ActionArgumentChoice choices = 5;
  33. string description = 6;
  34. map<string, string> suggestions = 7;
  35. string suggestions_browser_key = 8;
  36. }
  37. message ActionArgumentChoice {
  38. string value = 1;
  39. string title = 2;
  40. }
  41. message Entity {
  42. string title = 1;
  43. string unique_key = 2;
  44. string type = 3;
  45. repeated string directories = 4;
  46. map<string, string> fields = 5;
  47. }
  48. message GetDashboardResponse {
  49. string title = 1;
  50. Dashboard dashboard = 4;
  51. }
  52. message EffectivePolicy {
  53. bool show_diagnostics = 1;
  54. bool show_log_list = 2;
  55. bool show_version_number = 3;
  56. }
  57. message GetDashboardRequest {
  58. string title = 1;
  59. string entity_type = 2;
  60. string entity_key = 3;
  61. }
  62. message Dashboard {
  63. string title = 1;
  64. repeated DashboardComponent contents = 2;
  65. }
  66. message DashboardComponent {
  67. string title = 1;
  68. string type = 2;
  69. repeated DashboardComponent contents = 3;
  70. string icon = 4;
  71. string css_class = 5;
  72. Action action = 6;
  73. string entity_type = 7;
  74. string entity_key = 8;
  75. }
  76. message StartActionRequest {
  77. string binding_id = 1;
  78. repeated StartActionArgument arguments = 2;
  79. string unique_tracking_id = 3;
  80. }
  81. message StartActionArgument {
  82. string name = 1;
  83. string value = 2;
  84. }
  85. message StartActionResponse {
  86. string execution_tracking_id = 2;
  87. }
  88. message StartActionAndWaitRequest {
  89. string action_id = 1;
  90. repeated StartActionArgument arguments = 2;
  91. }
  92. message StartActionAndWaitResponse {
  93. LogEntry log_entry = 1;
  94. }
  95. message StartActionByGetRequest {
  96. string action_id = 1;
  97. }
  98. message StartActionByGetResponse {
  99. string execution_tracking_id = 2;
  100. }
  101. message StartActionByGetAndWaitRequest {
  102. string action_id = 1;
  103. }
  104. message StartActionByGetAndWaitResponse {
  105. LogEntry log_entry = 1;
  106. }
  107. message GetLogsRequest{
  108. int64 start_offset = 1;
  109. string date_filter = 2; // Optional date filter in YYYY-MM-DD format
  110. int64 page_size = 3; // Number of logs per page (optional; server default used if 0 or unset)
  111. };
  112. message LogEntry {
  113. string datetime_started = 1;
  114. string action_title = 2;
  115. string output = 3;
  116. bool timed_out = 5;
  117. int32 exit_code = 6;
  118. string user = 7;
  119. string user_class = 8;
  120. string action_icon = 9;
  121. repeated string tags = 10;
  122. string execution_tracking_id = 11;
  123. string datetime_finished = 12;
  124. bool execution_started = 14;
  125. bool execution_finished = 15;
  126. bool blocked = 16;
  127. int64 datetime_index = 17;
  128. bool can_kill = 18;
  129. string datetime_rate_limit_expires = 19; // Datetime when rate limit expires (empty string if not rate limited), format: "2006-01-02 15:04:05"
  130. string binding_id = 20; // Binding ID for matching rate limits to action buttons
  131. }
  132. message GetLogsResponse {
  133. repeated LogEntry logs = 1;
  134. int64 count_remaining = 2;
  135. int64 page_size = 3;
  136. int64 total_count = 4;
  137. int64 start_offset = 5;
  138. }
  139. message GetActionLogsRequest {
  140. string action_id = 1;
  141. int64 start_offset = 2;
  142. }
  143. message GetActionLogsResponse {
  144. repeated LogEntry logs = 1;
  145. int64 count_remaining = 2;
  146. int64 page_size = 3;
  147. int64 total_count = 4;
  148. int64 start_offset = 5;
  149. }
  150. message ValidateArgumentTypeRequest {
  151. string value = 1;
  152. string type = 2;
  153. string binding_id = 3;
  154. string argument_name = 4;
  155. }
  156. message ValidateArgumentTypeResponse {
  157. bool valid = 1;
  158. string description = 2;
  159. }
  160. message WatchExecutionRequest {
  161. string execution_tracking_id = 1;
  162. }
  163. message WatchExecutionUpdate {
  164. string update = 1;
  165. }
  166. message ExecutionStatusRequest {
  167. string execution_tracking_id = 1;
  168. string action_id = 2;
  169. }
  170. message ExecutionStatusResponse {
  171. LogEntry log_entry = 1;
  172. }
  173. message WhoAmIRequest {}
  174. message WhoAmIResponse {
  175. string authenticated_user = 1;
  176. string usergroup = 2;
  177. string provider = 3;
  178. repeated string acls = 4;
  179. string sid = 5;
  180. }
  181. message SosReportRequest {}
  182. message SosReportResponse {
  183. string alert = 1;
  184. }
  185. message DumpVarsRequest {}
  186. message DumpVarsResponse {
  187. string alert = 1;
  188. map<string, string> contents = 2;
  189. }
  190. message DebugBinding {
  191. string action_title = 1;
  192. string entity_prefix = 2;
  193. }
  194. message DumpPublicIdActionMapRequest {}
  195. message DumpPublicIdActionMapResponse {
  196. string alert = 1;
  197. map<string, DebugBinding> contents = 2;
  198. }
  199. message GetReadyzRequest {}
  200. message GetReadyzResponse {
  201. string status = 1;
  202. }
  203. message EventStreamRequest {
  204. }
  205. message EventStreamResponse {
  206. oneof event {
  207. EventEntityChanged entity_changed = 2;
  208. EventConfigChanged config_changed = 3;
  209. EventExecutionFinished execution_finished = 4;
  210. EventExecutionStarted execution_started = 5;
  211. EventOutputChunk output_chunk = 6;
  212. }
  213. }
  214. message EventOutputChunk {
  215. string execution_tracking_id = 1;
  216. string output = 2;
  217. }
  218. message EventEntityChanged {}
  219. message EventConfigChanged {}
  220. message EventExecutionFinished {
  221. LogEntry log_entry = 1;
  222. }
  223. message EventExecutionStarted {
  224. LogEntry log_entry = 1;
  225. }
  226. message KillActionRequest {
  227. string execution_tracking_id = 1;
  228. }
  229. message KillActionResponse {
  230. string execution_tracking_id = 1;
  231. bool killed = 2;
  232. bool already_completed = 3;
  233. bool found = 4;
  234. }
  235. message LocalUserLoginRequest {
  236. string username = 1;
  237. string password = 2;
  238. }
  239. message LocalUserLoginResponse {
  240. bool success = 1;
  241. }
  242. message PasswordHashRequest {
  243. string password = 1;
  244. }
  245. message PasswordHashResponse {
  246. string hash = 1;
  247. }
  248. message LogoutRequest {}
  249. message LogoutResponse {
  250. }
  251. message GetDiagnosticsRequest {
  252. }
  253. message GetDiagnosticsResponse {
  254. string SshFoundKey = 1;
  255. string SshFoundConfig = 2;
  256. }
  257. message InitRequest {}
  258. message InitResponse {
  259. bool showFooter = 1;
  260. bool showNavigation = 2;
  261. bool showNewVersions = 3;
  262. string availableVersion = 4;
  263. string currentVersion = 5;
  264. string pageTitle = 6;
  265. string sectionNavigationStyle = 7;
  266. string defaultIconForBack = 8;
  267. bool enableCustomJs = 9;
  268. string authLoginUrl = 10;
  269. bool authLocalLogin = 11;
  270. repeated string styleMods = 12;
  271. repeated OAuth2Provider oAuth2Providers = 13;
  272. repeated AdditionalLink additionalLinks = 14;
  273. repeated string rootDashboards = 15;
  274. string authenticated_user = 16;
  275. string authenticated_user_provider = 17;
  276. EffectivePolicy effective_policy = 18;
  277. string banner_message = 19;
  278. string banner_css = 20;
  279. bool show_diagnostics = 21;
  280. bool show_log_list = 22;
  281. bool login_required = 23;
  282. repeated string available_themes = 24; // List of available theme names
  283. bool show_navigate_on_start_icons = 25;
  284. }
  285. message AdditionalLink {
  286. string title = 1;
  287. string url = 2;
  288. }
  289. message OAuth2Provider {
  290. string title = 1;
  291. string icon = 3;
  292. string key = 4;
  293. }
  294. message GetActionBindingRequest {
  295. string binding_id = 1;
  296. }
  297. message GetActionBindingResponse {
  298. Action action = 1;
  299. }
  300. message GetEntitiesRequest {
  301. }
  302. message GetEntitiesResponse {
  303. repeated EntityDefinition entity_definitions = 1;
  304. }
  305. message EntityDefinition {
  306. string title = 1;
  307. repeated Entity instances = 2;
  308. repeated string used_on_dashboards = 3;
  309. }
  310. message GetEntityRequest {
  311. string unique_key = 1;
  312. string type = 2;
  313. }
  314. message RestartActionRequest {
  315. string execution_tracking_id = 1;
  316. }
  317. service OliveTinApiService {
  318. rpc GetDashboard(GetDashboardRequest) returns (GetDashboardResponse) {}
  319. rpc StartAction(StartActionRequest) returns (StartActionResponse) {}
  320. rpc StartActionAndWait(StartActionAndWaitRequest) returns (StartActionAndWaitResponse) {}
  321. rpc StartActionByGet(StartActionByGetRequest) returns (StartActionByGetResponse) {}
  322. rpc StartActionByGetAndWait(StartActionByGetAndWaitRequest) returns (StartActionByGetAndWaitResponse) {}
  323. rpc RestartAction(RestartActionRequest) returns (StartActionResponse) {}
  324. rpc KillAction(KillActionRequest) returns (KillActionResponse) {}
  325. rpc ExecutionStatus(ExecutionStatusRequest) returns (ExecutionStatusResponse) {}
  326. rpc GetLogs(GetLogsRequest) returns (GetLogsResponse) {}
  327. rpc GetActionLogs(GetActionLogsRequest) returns (GetActionLogsResponse) {}
  328. rpc ValidateArgumentType(ValidateArgumentTypeRequest) returns (ValidateArgumentTypeResponse) {}
  329. rpc WhoAmI(WhoAmIRequest) returns (WhoAmIResponse) {}
  330. rpc SosReport(SosReportRequest) returns (SosReportResponse) {}
  331. rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse) {}
  332. rpc DumpPublicIdActionMap(DumpPublicIdActionMapRequest) returns (DumpPublicIdActionMapResponse) {}
  333. rpc GetReadyz(GetReadyzRequest) returns (GetReadyzResponse) {}
  334. rpc LocalUserLogin(LocalUserLoginRequest) returns (LocalUserLoginResponse) {}
  335. rpc PasswordHash(PasswordHashRequest) returns (PasswordHashResponse) {}
  336. rpc Logout(LogoutRequest) returns (LogoutResponse) {}
  337. rpc EventStream(EventStreamRequest) returns (stream EventStreamResponse) {}
  338. rpc GetDiagnostics(GetDiagnosticsRequest) returns (GetDiagnosticsResponse) {}
  339. rpc Init(InitRequest) returns (InitResponse) {}
  340. rpc GetActionBinding(GetActionBindingRequest) returns (GetActionBindingResponse) {}
  341. rpc GetEntities(GetEntitiesRequest) returns (GetEntitiesResponse) {}
  342. rpc GetEntity(GetEntityRequest) returns (Entity) {}
  343. }