olivetin.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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. reserved 16;
  21. string justification = 20;
  22. bool has_running_instance = 17;
  23. bool has_queued_instance = 18;
  24. repeated ActionGroupMembership groups = 19;
  25. }
  26. message ActionGroupMembership {
  27. string name = 1;
  28. int32 max_concurrent = 2;
  29. int32 queue_size = 3;
  30. }
  31. message ActionWebhookExecHint {
  32. string template = 1;
  33. string match_path = 2;
  34. map<string, string> match_headers = 3;
  35. map<string, string> match_query = 4;
  36. }
  37. message ActionArgument {
  38. string name = 1;
  39. string title = 2;
  40. string type = 3;
  41. string default_value = 4;
  42. repeated ActionArgumentChoice choices = 5;
  43. string description = 6;
  44. map<string, string> suggestions = 7;
  45. string suggestions_browser_key = 8;
  46. }
  47. message ActionArgumentChoice {
  48. string value = 1;
  49. string title = 2;
  50. }
  51. message EntityRelatedAction {
  52. Action action = 1;
  53. map<string, string> prefilled_arguments = 2;
  54. }
  55. message Entity {
  56. string title = 1;
  57. string unique_key = 2;
  58. string type = 3;
  59. repeated string directories = 4;
  60. map<string, string> fields = 5;
  61. repeated EntityRelatedAction related_actions = 6;
  62. string icon = 7;
  63. }
  64. message GetDashboardResponse {
  65. string title = 1;
  66. Dashboard dashboard = 4;
  67. }
  68. message SearchHints {
  69. // Lightweight titles for client search only. Omits fields, icons, and payloads.
  70. // Dashboards are not included; clients index Init.root_dashboard_entries instead.
  71. repeated EntitySearchHint entities = 1;
  72. repeated ActionSearchHint actions = 2;
  73. }
  74. message EntitySearchHint {
  75. string title = 1;
  76. string type = 2;
  77. string unique_key = 3;
  78. }
  79. message ActionSearchHint {
  80. string title = 1;
  81. string binding_id = 2;
  82. }
  83. message EffectivePolicy {
  84. bool show_diagnostics = 1;
  85. bool show_log_list = 2;
  86. bool show_version_number = 3;
  87. }
  88. // Features are global opt-in flags from config.yaml features.*.
  89. // All flags default to false and gate alpha / experimental functionality.
  90. message Features {
  91. bool header_search = 1;
  92. }
  93. message GetDashboardRequest {
  94. string title = 1;
  95. string entity_type = 2;
  96. string entity_key = 3;
  97. }
  98. message Dashboard {
  99. string title = 1;
  100. repeated DashboardComponent contents = 2;
  101. }
  102. message DashboardComponent {
  103. string title = 1;
  104. string type = 2;
  105. repeated DashboardComponent contents = 3;
  106. string icon = 4;
  107. string css_class = 5;
  108. Action action = 6;
  109. string entity_type = 7;
  110. string entity_key = 8;
  111. }
  112. message StartActionRequest {
  113. string binding_id = 1;
  114. repeated StartActionArgument arguments = 2;
  115. string unique_tracking_id = 3;
  116. string justification = 4;
  117. }
  118. message StartActionArgument {
  119. string name = 1;
  120. string value = 2;
  121. }
  122. message StartActionResponse {
  123. string execution_tracking_id = 2;
  124. }
  125. message StartActionAndWaitRequest {
  126. string action_id = 1;
  127. repeated StartActionArgument arguments = 2;
  128. string justification = 3;
  129. }
  130. message StartActionAndWaitResponse {
  131. LogEntry log_entry = 1;
  132. }
  133. message StartActionByGetRequest {
  134. string action_id = 1;
  135. }
  136. message StartActionByGetResponse {
  137. string execution_tracking_id = 2;
  138. }
  139. message StartActionByGetAndWaitRequest {
  140. string action_id = 1;
  141. }
  142. message StartActionByGetAndWaitResponse {
  143. LogEntry log_entry = 1;
  144. }
  145. message GetLogsRequest{
  146. int64 start_offset = 1;
  147. string date_filter = 2; // Optional date filter in YYYY-MM-DD format
  148. int64 page_size = 3; // Number of logs per page (optional; server default used if 0 or unset)
  149. string filter = 4; // Optional filter expression (see logs UI syntax help)
  150. };
  151. message LogEntry {
  152. string datetime_started = 1;
  153. string action_title = 2;
  154. string output = 3;
  155. bool timed_out = 5;
  156. int32 exit_code = 6;
  157. string user = 7;
  158. string user_class = 8;
  159. string action_icon = 9;
  160. repeated string tags = 10;
  161. string execution_tracking_id = 11;
  162. string datetime_finished = 12;
  163. bool execution_started = 14;
  164. bool execution_finished = 15;
  165. bool blocked = 16;
  166. int64 datetime_index = 17;
  167. bool can_kill = 18;
  168. string datetime_rate_limit_expires = 19; // Datetime when rate limit expires (empty string if not rate limited), format: "2006-01-02 15:04:05"
  169. string binding_id = 20; // Binding ID for matching rate limits to action buttons
  170. bool queued = 21;
  171. string queued_for_group = 22;
  172. string justification = 23;
  173. repeated StartActionArgument arguments = 24;
  174. }
  175. message GetLogsResponse {
  176. repeated LogEntry logs = 1;
  177. int64 count_remaining = 2;
  178. int64 page_size = 3;
  179. int64 total_count = 4;
  180. int64 start_offset = 5;
  181. }
  182. message GetActionLogsRequest {
  183. string action_id = 1;
  184. int64 start_offset = 2;
  185. }
  186. message GetActionLogsResponse {
  187. repeated LogEntry logs = 1;
  188. int64 count_remaining = 2;
  189. int64 page_size = 3;
  190. int64 total_count = 4;
  191. int64 start_offset = 5;
  192. }
  193. message GetExecutionQueueRequest {}
  194. message ExecutionQueueAction {
  195. string binding_id = 1;
  196. string action_title = 2;
  197. string action_icon = 3;
  198. int32 max_concurrent = 4;
  199. int32 active_count = 5;
  200. string entity_prefix = 6;
  201. repeated LogEntry entries = 7;
  202. }
  203. message ExecutionQueueGroup {
  204. string name = 1;
  205. string icon = 2;
  206. int32 max_concurrent = 3;
  207. int32 active_count = 4;
  208. repeated ExecutionQueueAction actions = 5;
  209. int32 queued_count = 6;
  210. int32 queue_size = 7;
  211. }
  212. message GetExecutionQueueResponse {
  213. repeated ExecutionQueueGroup groups = 1;
  214. int32 total_active = 2;
  215. }
  216. message ValidateArgumentTypeRequest {
  217. string value = 1;
  218. string type = 2;
  219. string binding_id = 3;
  220. string argument_name = 4;
  221. }
  222. message ValidateArgumentTypeResponse {
  223. bool valid = 1;
  224. string description = 2;
  225. }
  226. message WatchExecutionRequest {
  227. string execution_tracking_id = 1;
  228. }
  229. message WatchExecutionUpdate {
  230. string update = 1;
  231. }
  232. message ExecutionStatusRequest {
  233. string execution_tracking_id = 1;
  234. string action_id = 2;
  235. }
  236. message DashboardNavigationTarget {
  237. string title = 1;
  238. string entity_type = 2;
  239. string entity_key = 3;
  240. string path = 4;
  241. }
  242. message ExecutionStatusResponse {
  243. LogEntry log_entry = 1;
  244. repeated DashboardNavigationTarget back_to_dashboards = 2;
  245. }
  246. message WhoAmIRequest {}
  247. message WhoAmIResponse {
  248. string authenticated_user = 1;
  249. string usergroup = 2;
  250. string provider = 3;
  251. repeated string acls = 4;
  252. // The session ID was returned here until it was replaced by
  253. // session_fingerprint, because the session ID is the session's
  254. // credential.
  255. reserved 5;
  256. reserved "sid";
  257. string session_fingerprint = 6;
  258. }
  259. message ServerDiagnosticsRequest {}
  260. message ServerDiagnosticsResponse {
  261. string alert = 1;
  262. }
  263. message DumpVarsRequest {}
  264. message DumpVarsResponse {
  265. string alert = 1;
  266. map<string, string> contents = 2;
  267. }
  268. message DebugBinding {
  269. string action_title = 1;
  270. string entity_prefix = 2;
  271. }
  272. message DumpPublicIdActionMapRequest {}
  273. message DumpPublicIdActionMapResponse {
  274. string alert = 1;
  275. map<string, DebugBinding> contents = 2;
  276. }
  277. message GetReadyzRequest {}
  278. message GetReadyzResponse {
  279. string status = 1;
  280. }
  281. message EventStreamRequest {
  282. }
  283. message EventStreamResponse {
  284. oneof event {
  285. EventEntityChanged entity_changed = 2;
  286. EventConfigChanged config_changed = 3;
  287. EventExecutionFinished execution_finished = 4;
  288. EventExecutionStarted execution_started = 5;
  289. EventOutputChunk output_chunk = 6;
  290. EventHeartbeat heartbeat = 7;
  291. }
  292. }
  293. message EventOutputChunk {
  294. string execution_tracking_id = 1;
  295. string output = 2;
  296. }
  297. message EventEntityChanged {}
  298. message EventConfigChanged {}
  299. message EventHeartbeat {}
  300. message EventExecutionFinished {
  301. LogEntry log_entry = 1;
  302. }
  303. message EventExecutionStarted {
  304. LogEntry log_entry = 1;
  305. }
  306. message KillActionRequest {
  307. string execution_tracking_id = 1;
  308. }
  309. message KillActionResponse {
  310. string execution_tracking_id = 1;
  311. bool killed = 2;
  312. bool already_completed = 3;
  313. bool found = 4;
  314. }
  315. message LocalUserLoginRequest {
  316. string username = 1;
  317. string password = 2;
  318. }
  319. message LocalUserLoginResponse {
  320. bool success = 1;
  321. }
  322. message PasswordHashRequest {
  323. string password = 1;
  324. }
  325. message PasswordHashResponse {
  326. string hash = 1;
  327. }
  328. message LogoutRequest {}
  329. message LogoutResponse {
  330. }
  331. message GetDiagnosticsRequest {
  332. }
  333. message ConfigIssue {
  334. string severity = 1;
  335. string code = 2;
  336. string message = 3;
  337. string action_id = 4;
  338. string action_title = 5;
  339. string argument_name = 6;
  340. string source = 7;
  341. string config_file = 8;
  342. }
  343. message GetDiagnosticsResponse {
  344. string SshFoundKey = 1;
  345. string SshFoundConfig = 2;
  346. repeated ConfigIssue config_issues = 3;
  347. }
  348. message InitRequest {}
  349. message InitResponse {
  350. bool showFooter = 1;
  351. bool showNavigation = 2;
  352. bool showNewVersions = 3;
  353. string availableVersion = 4;
  354. string currentVersion = 5;
  355. string pageTitle = 6;
  356. string sectionNavigationStyle = 7;
  357. string defaultIconForBack = 8;
  358. bool enableCustomJs = 9;
  359. string authLoginUrl = 10;
  360. bool authLocalLogin = 11;
  361. repeated string styleMods = 12;
  362. repeated OAuth2Provider oAuth2Providers = 13;
  363. repeated AdditionalLink additionalLinks = 14;
  364. repeated string rootDashboards = 15;
  365. string authenticated_user = 16;
  366. string authenticated_user_provider = 17;
  367. EffectivePolicy effective_policy = 18;
  368. string banner_message = 19;
  369. string banner_css = 20;
  370. bool show_diagnostics = 21;
  371. bool show_log_list = 22;
  372. bool login_required = 23;
  373. repeated string available_themes = 24; // List of available theme names
  374. bool show_navigate_on_start_icons = 25;
  375. int32 config_issue_count = 26;
  376. repeated RootDashboard root_dashboard_entries = 27;
  377. // Client-side search index hints. Omitted when login is required
  378. // or features.header_search is false.
  379. // Entities match GetEntities visibility; actions use view ACL.
  380. // Dashboards are indexed client-side from root_dashboard_entries.
  381. SearchHints search_hints = 28;
  382. Features features = 29;
  383. }
  384. message RootDashboard {
  385. string title = 1;
  386. string category = 2;
  387. }
  388. message AdditionalLink {
  389. string title = 1;
  390. string url = 2;
  391. }
  392. message OAuth2Provider {
  393. string title = 1;
  394. string icon = 3;
  395. string key = 4;
  396. }
  397. message GetActionBindingRequest {
  398. string binding_id = 1;
  399. }
  400. message GetActionBindingResponse {
  401. Action action = 1;
  402. repeated DashboardNavigationTarget back_to_dashboards = 2;
  403. }
  404. message GetEntitiesRequest {
  405. string entity_type = 1;
  406. string filter = 2;
  407. int32 page = 3;
  408. int32 page_size = 4;
  409. }
  410. message GetEntitiesResponse {
  411. repeated EntityDefinition entity_definitions = 1;
  412. }
  413. message EntityDefinition {
  414. string title = 1;
  415. repeated Entity instances = 2;
  416. repeated string used_on_dashboards = 3;
  417. string icon = 4;
  418. repeated EntityProperty properties = 5;
  419. int32 total_instances = 6;
  420. }
  421. message EntityProperty {
  422. string name = 1;
  423. string title = 2;
  424. }
  425. message GetEntityRequest {
  426. string unique_key = 1;
  427. string type = 2;
  428. }
  429. message RestartActionRequest {
  430. string execution_tracking_id = 1;
  431. }
  432. service OliveTinApiService {
  433. rpc GetDashboard(GetDashboardRequest) returns (GetDashboardResponse) {}
  434. rpc StartAction(StartActionRequest) returns (StartActionResponse) {}
  435. rpc StartActionAndWait(StartActionAndWaitRequest) returns (StartActionAndWaitResponse) {}
  436. // Use StartAction instead; this method will be removed. See https://github.com/OliveTin/OliveTin/issues/1028
  437. rpc StartActionByGet(StartActionByGetRequest) returns (StartActionByGetResponse) {
  438. option deprecated = true;
  439. }
  440. // Use StartActionAndWait instead; this method will be removed. See https://github.com/OliveTin/OliveTin/issues/1028
  441. rpc StartActionByGetAndWait(StartActionByGetAndWaitRequest) returns (StartActionByGetAndWaitResponse) {
  442. option deprecated = true;
  443. }
  444. rpc RestartAction(RestartActionRequest) returns (StartActionResponse) {}
  445. rpc KillAction(KillActionRequest) returns (KillActionResponse) {}
  446. rpc ExecutionStatus(ExecutionStatusRequest) returns (ExecutionStatusResponse) {}
  447. rpc GetLogs(GetLogsRequest) returns (GetLogsResponse) {}
  448. rpc GetActionLogs(GetActionLogsRequest) returns (GetActionLogsResponse) {}
  449. rpc GetExecutionQueue(GetExecutionQueueRequest) returns (GetExecutionQueueResponse) {}
  450. rpc ValidateArgumentType(ValidateArgumentTypeRequest) returns (ValidateArgumentTypeResponse) {}
  451. rpc WhoAmI(WhoAmIRequest) returns (WhoAmIResponse) {}
  452. rpc ServerDiagnostics(ServerDiagnosticsRequest) returns (ServerDiagnosticsResponse) {}
  453. rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse) {}
  454. rpc DumpPublicIdActionMap(DumpPublicIdActionMapRequest) returns (DumpPublicIdActionMapResponse) {}
  455. rpc GetReadyz(GetReadyzRequest) returns (GetReadyzResponse) {}
  456. rpc LocalUserLogin(LocalUserLoginRequest) returns (LocalUserLoginResponse) {}
  457. rpc PasswordHash(PasswordHashRequest) returns (PasswordHashResponse) {}
  458. rpc Logout(LogoutRequest) returns (LogoutResponse) {}
  459. rpc EventStream(EventStreamRequest) returns (stream EventStreamResponse) {}
  460. rpc GetDiagnostics(GetDiagnosticsRequest) returns (GetDiagnosticsResponse) {}
  461. rpc Init(InitRequest) returns (InitResponse) {}
  462. rpc GetActionBinding(GetActionBindingRequest) returns (GetActionBindingResponse) {}
  463. rpc GetEntities(GetEntitiesRequest) returns (GetEntitiesResponse) {}
  464. rpc GetEntity(GetEntityRequest) returns (Entity) {}
  465. }