summaryrefslogtreecommitdiff
path: root/src/vyconf_types.mli
blob: 194d66ceaf139041900107ec887e490007f32db6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
(** vyconf.proto Types *)



(** {2 Types} *)

type request_config_format =
  | Curly 
  | Json 

type request_output_format =
  | Out_plain 
  | Out_json 

type request_setup_session = {
  client_application : string option;
  on_behalf_of : int32 option;
}

type request_set = {
  path : string list;
  ephemeral : bool option;
}

type request_delete = {
  path : string list;
}

type request_rename = {
  edit_level : string list;
  from : string;
  to_ : string;
}

type request_copy = {
  edit_level : string list;
  from : string;
  to_ : string;
}

type request_comment = {
  path : string list;
  comment : string;
}

type request_commit = {
  confirm : bool option;
  confirm_timeout : int32 option;
  comment : string option;
}

type request_rollback = {
  revision : int32;
}

type request_load = {
  location : string;
  format : request_config_format option;
}

type request_merge = {
  location : string;
  format : request_config_format option;
}

type request_save = {
  location : string;
  format : request_config_format option;
}

type request_show_config = {
  path : string list;
  format : request_config_format option;
}

type request_exists = {
  path : string list;
}

type request_get_value = {
  path : string list;
  output_format : request_output_format option;
}

type request_get_values = {
  path : string list;
  output_format : request_output_format option;
}

type request_list_children = {
  path : string list;
  output_format : request_output_format option;
}

type request_run_op_mode = {
  path : string list;
  output_format : request_output_format option;
}

type request_enter_configuration_mode = {
  exclusive : bool;
  override_exclusive : bool;
}

type request =
  | Status
  | Setup_session of request_setup_session
  | Set of request_set
  | Delete of request_delete
  | Rename of request_rename
  | Copy of request_copy
  | Comment of request_comment
  | Commit of request_commit
  | Rollback of request_rollback
  | Merge of request_merge
  | Save of request_save
  | Show_config of request_show_config
  | Exists of request_exists
  | Get_value of request_get_value
  | Get_values of request_get_values
  | List_children of request_list_children
  | Run_op_mode of request_run_op_mode
  | Confirm
  | Configure of request_enter_configuration_mode
  | Exit_configure
  | Teardown of string

type request_envelope = {
  token : string option;
  request : request;
}

type status =
  | Success 
  | Fail 
  | Invalid_path 
  | Invalid_value 
  | Commit_in_progress 
  | Configuration_locked 
  | Internal_error 
  | Permission_denied 
  | Path_already_exists 

type response = {
  status : status;
  output : string option;
  error : string option;
  warning : string option;
}


(** {2 Default values} *)

val default_request_config_format : unit -> request_config_format
(** [default_request_config_format ()] is the default value for type [request_config_format] *)

val default_request_output_format : unit -> request_output_format
(** [default_request_output_format ()] is the default value for type [request_output_format] *)

val default_request_setup_session : 
  ?client_application:string option ->
  ?on_behalf_of:int32 option ->
  unit ->
  request_setup_session
(** [default_request_setup_session ()] is the default value for type [request_setup_session] *)

val default_request_set : 
  ?path:string list ->
  ?ephemeral:bool option ->
  unit ->
  request_set
(** [default_request_set ()] is the default value for type [request_set] *)

val default_request_delete : 
  ?path:string list ->
  unit ->
  request_delete
(** [default_request_delete ()] is the default value for type [request_delete] *)

val default_request_rename : 
  ?edit_level:string list ->
  ?from:string ->
  ?to_:string ->
  unit ->
  request_rename
(** [default_request_rename ()] is the default value for type [request_rename] *)

val default_request_copy : 
  ?edit_level:string list ->
  ?from:string ->
  ?to_:string ->
  unit ->
  request_copy
(** [default_request_copy ()] is the default value for type [request_copy] *)

val default_request_comment : 
  ?path:string list ->
  ?comment:string ->
  unit ->
  request_comment
(** [default_request_comment ()] is the default value for type [request_comment] *)

val default_request_commit : 
  ?confirm:bool option ->
  ?confirm_timeout:int32 option ->
  ?comment:string option ->
  unit ->
  request_commit
(** [default_request_commit ()] is the default value for type [request_commit] *)

val default_request_rollback : 
  ?revision:int32 ->
  unit ->
  request_rollback
(** [default_request_rollback ()] is the default value for type [request_rollback] *)

val default_request_load : 
  ?location:string ->
  ?format:request_config_format option ->
  unit ->
  request_load
(** [default_request_load ()] is the default value for type [request_load] *)

val default_request_merge : 
  ?location:string ->
  ?format:request_config_format option ->
  unit ->
  request_merge
(** [default_request_merge ()] is the default value for type [request_merge] *)

val default_request_save : 
  ?location:string ->
  ?format:request_config_format option ->
  unit ->
  request_save
(** [default_request_save ()] is the default value for type [request_save] *)

val default_request_show_config : 
  ?path:string list ->
  ?format:request_config_format option ->
  unit ->
  request_show_config
(** [default_request_show_config ()] is the default value for type [request_show_config] *)

val default_request_exists : 
  ?path:string list ->
  unit ->
  request_exists
(** [default_request_exists ()] is the default value for type [request_exists] *)

val default_request_get_value : 
  ?path:string list ->
  ?output_format:request_output_format option ->
  unit ->
  request_get_value
(** [default_request_get_value ()] is the default value for type [request_get_value] *)

val default_request_get_values : 
  ?path:string list ->
  ?output_format:request_output_format option ->
  unit ->
  request_get_values
(** [default_request_get_values ()] is the default value for type [request_get_values] *)

val default_request_list_children : 
  ?path:string list ->
  ?output_format:request_output_format option ->
  unit ->
  request_list_children
(** [default_request_list_children ()] is the default value for type [request_list_children] *)

val default_request_run_op_mode : 
  ?path:string list ->
  ?output_format:request_output_format option ->
  unit ->
  request_run_op_mode
(** [default_request_run_op_mode ()] is the default value for type [request_run_op_mode] *)

val default_request_enter_configuration_mode : 
  ?exclusive:bool ->
  ?override_exclusive:bool ->
  unit ->
  request_enter_configuration_mode
(** [default_request_enter_configuration_mode ()] is the default value for type [request_enter_configuration_mode] *)

val default_request : unit -> request
(** [default_request ()] is the default value for type [request] *)

val default_request_envelope : 
  ?token:string option ->
  ?request:request ->
  unit ->
  request_envelope
(** [default_request_envelope ()] is the default value for type [request_envelope] *)

val default_status : unit -> status
(** [default_status ()] is the default value for type [status] *)

val default_response : 
  ?status:status ->
  ?output:string option ->
  ?error:string option ->
  ?warning:string option ->
  unit ->
  response
(** [default_response ()] is the default value for type [response] *)