summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-02-11 09:53:45 +0700
committerDaniil Baturin <daniil@baturin.org>2018-02-11 09:53:45 +0700
commit76c2a472f9f4869b8a06976eca1c1a025400ca66 (patch)
treec9f64e42b90d1075faa19803b5ccc1c98fb93833 /src
parenta3abb4d9163b80bba036b75e7c8d817a13d313b0 (diff)
downloadvyconf-76c2a472f9f4869b8a06976eca1c1a025400ca66.tar.gz
vyconf-76c2a472f9f4869b8a06976eca1c1a025400ca66.zip
Add output format option (plain or JSON) to the config data reading and op mode functions.
Re-generate the protobuf-derived modules. NB: Newer versions of ocaml-protoc moved types to a separate module, needs to be accounted for in other files.
Diffstat (limited to 'src')
-rw-r--r--src/vyconf_pb.ml1945
-rw-r--r--src/vyconf_pb.mli511
-rw-r--r--src/vyconf_types.ml318
-rw-r--r--src/vyconf_types.mli306
4 files changed, 1420 insertions, 1660 deletions
diff --git a/src/vyconf_pb.ml b/src/vyconf_pb.ml
index b2937cd..4dced0f 100644
--- a/src/vyconf_pb.ml
+++ b/src/vyconf_pb.ml
@@ -1,981 +1,712 @@
[@@@ocaml.warning "-27-30-39"]
-type request_config_format =
- | Curly
- | Json
-
-type request_setup_session = {
- client_application : string option;
- on_behalf_of : int32 option;
-}
-
-and request_setup_session_mutable = {
+type request_setup_session_mutable = {
mutable client_application : string option;
mutable on_behalf_of : int32 option;
}
-type request_set = {
- path : string list;
- ephemeral : bool option;
+let default_request_setup_session_mutable () : request_setup_session_mutable = {
+ client_application = None;
+ on_behalf_of = None;
}
-and request_set_mutable = {
+type request_set_mutable = {
mutable path : string list;
mutable ephemeral : bool option;
}
-type request_delete = {
- path : string list;
+let default_request_set_mutable () : request_set_mutable = {
+ path = [];
+ ephemeral = None;
}
-and request_delete_mutable = {
+type request_delete_mutable = {
mutable path : string list;
}
-type request_rename = {
- edit_level : string list;
- from : string;
- to_ : string;
-}
-
-and request_rename_mutable = {
- mutable edit_level : string list;
- mutable from : string;
- mutable to_ : string;
-}
-
-type request_copy = {
- edit_level : string list;
- from : string;
- to_ : string;
+let default_request_delete_mutable () : request_delete_mutable = {
+ path = [];
}
-and request_copy_mutable = {
+type request_rename_mutable = {
mutable edit_level : string list;
mutable from : string;
mutable to_ : string;
}
-type request_comment = {
- path : string list;
- comment : string;
-}
-
-and request_comment_mutable = {
- mutable path : string list;
- mutable comment : string;
-}
-
-type request_commit = {
- confirm : bool option;
- confirm_timeout : int32 option;
- comment : string option;
-}
-
-and request_commit_mutable = {
- mutable confirm : bool option;
- mutable confirm_timeout : int32 option;
- mutable comment : string option;
-}
-
-type request_rollback = {
- revision : int32;
-}
-
-and request_rollback_mutable = {
- mutable revision : int32;
-}
-
-type request_load = {
- location : string;
- format : request_config_format option;
-}
-
-and request_load_mutable = {
- mutable location : string;
- mutable format : request_config_format option;
-}
-
-type request_merge = {
- location : string;
- format : request_config_format option;
-}
-
-and request_merge_mutable = {
- mutable location : string;
- mutable format : request_config_format option;
-}
-
-type request_save = {
- location : string;
- format : request_config_format option;
-}
-
-and request_save_mutable = {
- mutable location : string;
- mutable format : request_config_format option;
-}
-
-type request_show_config = {
- path : string list;
- format : request_config_format option;
-}
-
-and request_show_config_mutable = {
- mutable path : string list;
- mutable format : request_config_format option;
-}
-
-type request_exists = {
- path : string list;
-}
-
-and request_exists_mutable = {
- mutable path : string list;
-}
-
-type request_get_value = {
- path : string list;
-}
-
-and request_get_value_mutable = {
- mutable path : string list;
-}
-
-type request_get_values = {
- path : string list;
-}
-
-and request_get_values_mutable = {
- mutable path : string list;
-}
-
-type request_list_children = {
- path : string list;
-}
-
-and request_list_children_mutable = {
- mutable path : string list;
-}
-
-type request_run_op_mode = {
- path : string list;
-}
-
-and request_run_op_mode_mutable = {
- mutable path : string list;
-}
-
-type request_enter_configuration_mode = {
- exclusive : bool;
- override_exclusive : bool;
-}
-
-and request_enter_configuration_mode_mutable = {
- mutable exclusive : bool;
- mutable 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;
-}
-
-and request_envelope_mutable = {
- mutable token : string option;
- mutable 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;
-}
-
-and response_mutable = {
- mutable status : status;
- mutable output : string option;
- mutable error : string option;
- mutable warning : string option;
-}
-
-let rec default_request_config_format () = (Curly:request_config_format)
-
-let rec default_request_setup_session
- ?client_application:((client_application:string option) = None)
- ?on_behalf_of:((on_behalf_of:int32 option) = None)
- () : request_setup_session = {
- client_application;
- on_behalf_of;
-}
-
-and default_request_setup_session_mutable () : request_setup_session_mutable = {
- client_application = None;
- on_behalf_of = None;
-}
-
-let rec default_request_set
- ?path:((path:string list) = [])
- ?ephemeral:((ephemeral:bool option) = None)
- () : request_set = {
- path;
- ephemeral;
-}
-
-and default_request_set_mutable () : request_set_mutable = {
- path = [];
- ephemeral = None;
-}
-
-let rec default_request_delete
- ?path:((path:string list) = [])
- () : request_delete = {
- path;
-}
-
-and default_request_delete_mutable () : request_delete_mutable = {
- path = [];
-}
-
-let rec default_request_rename
- ?edit_level:((edit_level:string list) = [])
- ?from:((from:string) = "")
- ?to_:((to_:string) = "")
- () : request_rename = {
- edit_level;
- from;
- to_;
-}
-
-and default_request_rename_mutable () : request_rename_mutable = {
+let default_request_rename_mutable () : request_rename_mutable = {
edit_level = [];
from = "";
to_ = "";
}
-let rec default_request_copy
- ?edit_level:((edit_level:string list) = [])
- ?from:((from:string) = "")
- ?to_:((to_:string) = "")
- () : request_copy = {
- edit_level;
- from;
- to_;
+type request_copy_mutable = {
+ mutable edit_level : string list;
+ mutable from : string;
+ mutable to_ : string;
}
-and default_request_copy_mutable () : request_copy_mutable = {
+let default_request_copy_mutable () : request_copy_mutable = {
edit_level = [];
from = "";
to_ = "";
}
-let rec default_request_comment
- ?path:((path:string list) = [])
- ?comment:((comment:string) = "")
- () : request_comment = {
- path;
- comment;
+type request_comment_mutable = {
+ mutable path : string list;
+ mutable comment : string;
}
-and default_request_comment_mutable () : request_comment_mutable = {
+let default_request_comment_mutable () : request_comment_mutable = {
path = [];
comment = "";
}
-let rec default_request_commit
- ?confirm:((confirm:bool option) = None)
- ?confirm_timeout:((confirm_timeout:int32 option) = None)
- ?comment:((comment:string option) = None)
- () : request_commit = {
- confirm;
- confirm_timeout;
- comment;
+type request_commit_mutable = {
+ mutable confirm : bool option;
+ mutable confirm_timeout : int32 option;
+ mutable comment : string option;
}
-and default_request_commit_mutable () : request_commit_mutable = {
+let default_request_commit_mutable () : request_commit_mutable = {
confirm = None;
confirm_timeout = None;
comment = None;
}
-let rec default_request_rollback
- ?revision:((revision:int32) = 0l)
- () : request_rollback = {
- revision;
+type request_rollback_mutable = {
+ mutable revision : int32;
}
-and default_request_rollback_mutable () : request_rollback_mutable = {
+let default_request_rollback_mutable () : request_rollback_mutable = {
revision = 0l;
}
-let rec default_request_load
- ?location:((location:string) = "")
- ?format:((format:request_config_format option) = None)
- () : request_load = {
- location;
- format;
+type request_load_mutable = {
+ mutable location : string;
+ mutable format : Vyconf_types.request_config_format option;
}
-and default_request_load_mutable () : request_load_mutable = {
+let default_request_load_mutable () : request_load_mutable = {
location = "";
format = None;
}
-let rec default_request_merge
- ?location:((location:string) = "")
- ?format:((format:request_config_format option) = None)
- () : request_merge = {
- location;
- format;
+type request_merge_mutable = {
+ mutable location : string;
+ mutable format : Vyconf_types.request_config_format option;
}
-and default_request_merge_mutable () : request_merge_mutable = {
+let default_request_merge_mutable () : request_merge_mutable = {
location = "";
format = None;
}
-let rec default_request_save
- ?location:((location:string) = "")
- ?format:((format:request_config_format option) = None)
- () : request_save = {
- location;
- format;
+type request_save_mutable = {
+ mutable location : string;
+ mutable format : Vyconf_types.request_config_format option;
}
-and default_request_save_mutable () : request_save_mutable = {
+let default_request_save_mutable () : request_save_mutable = {
location = "";
format = None;
}
-let rec default_request_show_config
- ?path:((path:string list) = [])
- ?format:((format:request_config_format option) = None)
- () : request_show_config = {
- path;
- format;
+type request_show_config_mutable = {
+ mutable path : string list;
+ mutable format : Vyconf_types.request_config_format option;
}
-and default_request_show_config_mutable () : request_show_config_mutable = {
+let default_request_show_config_mutable () : request_show_config_mutable = {
path = [];
format = None;
}
-let rec default_request_exists
- ?path:((path:string list) = [])
- () : request_exists = {
- path;
+type request_exists_mutable = {
+ mutable path : string list;
}
-and default_request_exists_mutable () : request_exists_mutable = {
+let default_request_exists_mutable () : request_exists_mutable = {
path = [];
}
-let rec default_request_get_value
- ?path:((path:string list) = [])
- () : request_get_value = {
- path;
+type request_get_value_mutable = {
+ mutable path : string list;
+ mutable output_format : Vyconf_types.request_output_format option;
}
-and default_request_get_value_mutable () : request_get_value_mutable = {
+let default_request_get_value_mutable () : request_get_value_mutable = {
path = [];
+ output_format = None;
}
-let rec default_request_get_values
- ?path:((path:string list) = [])
- () : request_get_values = {
- path;
+type request_get_values_mutable = {
+ mutable path : string list;
+ mutable output_format : Vyconf_types.request_output_format option;
}
-and default_request_get_values_mutable () : request_get_values_mutable = {
+let default_request_get_values_mutable () : request_get_values_mutable = {
path = [];
+ output_format = None;
}
-let rec default_request_list_children
- ?path:((path:string list) = [])
- () : request_list_children = {
- path;
+type request_list_children_mutable = {
+ mutable path : string list;
+ mutable output_format : Vyconf_types.request_output_format option;
}
-and default_request_list_children_mutable () : request_list_children_mutable = {
+let default_request_list_children_mutable () : request_list_children_mutable = {
path = [];
+ output_format = None;
}
-let rec default_request_run_op_mode
- ?path:((path:string list) = [])
- () : request_run_op_mode = {
- path;
+type request_run_op_mode_mutable = {
+ mutable path : string list;
+ mutable output_format : Vyconf_types.request_output_format option;
}
-and default_request_run_op_mode_mutable () : request_run_op_mode_mutable = {
+let default_request_run_op_mode_mutable () : request_run_op_mode_mutable = {
path = [];
+ output_format = None;
}
-let rec default_request_enter_configuration_mode
- ?exclusive:((exclusive:bool) = false)
- ?override_exclusive:((override_exclusive:bool) = false)
- () : request_enter_configuration_mode = {
- exclusive;
- override_exclusive;
+type request_enter_configuration_mode_mutable = {
+ mutable exclusive : bool;
+ mutable override_exclusive : bool;
}
-and default_request_enter_configuration_mode_mutable () : request_enter_configuration_mode_mutable = {
+let default_request_enter_configuration_mode_mutable () : request_enter_configuration_mode_mutable = {
exclusive = false;
override_exclusive = false;
}
-let rec default_request (): request = Status
-
-let rec default_request_envelope
- ?token:((token:string option) = None)
- ?request:((request:request) = default_request ())
- () : request_envelope = {
- token;
- request;
+type request_envelope_mutable = {
+ mutable token : string option;
+ mutable request : Vyconf_types.request;
}
-and default_request_envelope_mutable () : request_envelope_mutable = {
+let default_request_envelope_mutable () : request_envelope_mutable = {
token = None;
- request = default_request ();
+ request = Vyconf_types.default_request ();
}
-let rec default_status () = (Success:status)
-
-let rec default_response
- ?status:((status:status) = default_status ())
- ?output:((output:string option) = None)
- ?error:((error:string option) = None)
- ?warning:((warning:string option) = None)
- () : response = {
- status;
- output;
- error;
- warning;
+type response_mutable = {
+ mutable status : Vyconf_types.status;
+ mutable output : string option;
+ mutable error : string option;
+ mutable warning : string option;
}
-and default_response_mutable () : response_mutable = {
- status = default_status ();
+let default_response_mutable () : response_mutable = {
+ status = Vyconf_types.default_status ();
output = None;
error = None;
warning = None;
}
+
let rec decode_request_config_format d =
match Pbrt.Decoder.int_as_varint d with
- | 0 -> (Curly:request_config_format)
- | 1 -> (Json:request_config_format)
- | _ -> failwith "Unknown value for enum request_config_format"
+ | 0 -> (Vyconf_types.Curly:Vyconf_types.request_config_format)
+ | 1 -> (Vyconf_types.Json:Vyconf_types.request_config_format)
+ | _ -> Pbrt.Decoder.malformed_variant "request_config_format"
+
+let rec decode_request_output_format d =
+ match Pbrt.Decoder.int_as_varint d with
+ | 0 -> (Vyconf_types.Out_plain:Vyconf_types.request_output_format)
+ | 1 -> (Vyconf_types.Out_json:Vyconf_types.request_output_format)
+ | _ -> Pbrt.Decoder.malformed_variant "request_output_format"
let rec decode_request_setup_session d =
let v = default_request_setup_session_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.client_application <- Some (Pbrt.Decoder.string d);
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_setup_session), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_setup_session), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
v.on_behalf_of <- Some (Pbrt.Decoder.int32_as_varint d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_setup_session), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_setup_session = Obj.magic v in
- v
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_setup_session), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.client_application = v.client_application;
+ Vyconf_types.on_behalf_of = v.on_behalf_of;
+ } : Vyconf_types.request_setup_session)
let rec decode_request_set d =
let v = default_request_set_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_set), field(1)", pk))
- )
- | Some (3, Pbrt.Varint) -> (
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_set), field(1)" pk
+ | Some (3, Pbrt.Varint) -> begin
v.ephemeral <- Some (Pbrt.Decoder.bool d);
- loop ()
- )
- | Some (3, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_set), field(3)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_set = Obj.magic v in
- v
+ end
+ | Some (3, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_set), field(3)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.ephemeral = v.ephemeral;
+ } : Vyconf_types.request_set)
let rec decode_request_delete d =
let v = default_request_delete_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_delete), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_delete = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_delete), field(1)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ } : Vyconf_types.request_delete)
let rec decode_request_rename d =
let v = default_request_rename_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let to__is_set = ref false in
+ let from_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.edit_level <- List.rev v.edit_level;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.edit_level <- (Pbrt.Decoder.string d) :: v.edit_level;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_rename), field(1)", pk))
- )
- | Some (2, Pbrt.Bytes) -> (
- v.from <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_rename), field(2)", pk))
- )
- | Some (3, Pbrt.Bytes) -> (
- v.to_ <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (3, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_rename), field(3)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_rename = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_rename), field(1)" pk
+ | Some (2, Pbrt.Bytes) -> begin
+ v.from <- Pbrt.Decoder.string d; from_is_set := true;
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_rename), field(2)" pk
+ | Some (3, Pbrt.Bytes) -> begin
+ v.to_ <- Pbrt.Decoder.string d; to__is_set := true;
+ end
+ | Some (3, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_rename), field(3)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !to__is_set then Pbrt.Decoder.missing_field "to_" end;
+ begin if not !from_is_set then Pbrt.Decoder.missing_field "from" end;
+ ({
+ Vyconf_types.edit_level = v.edit_level;
+ Vyconf_types.from = v.from;
+ Vyconf_types.to_ = v.to_;
+ } : Vyconf_types.request_rename)
let rec decode_request_copy d =
let v = default_request_copy_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let to__is_set = ref false in
+ let from_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.edit_level <- List.rev v.edit_level;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.edit_level <- (Pbrt.Decoder.string d) :: v.edit_level;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_copy), field(1)", pk))
- )
- | Some (2, Pbrt.Bytes) -> (
- v.from <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_copy), field(2)", pk))
- )
- | Some (3, Pbrt.Bytes) -> (
- v.to_ <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (3, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_copy), field(3)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_copy = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_copy), field(1)" pk
+ | Some (2, Pbrt.Bytes) -> begin
+ v.from <- Pbrt.Decoder.string d; from_is_set := true;
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_copy), field(2)" pk
+ | Some (3, Pbrt.Bytes) -> begin
+ v.to_ <- Pbrt.Decoder.string d; to__is_set := true;
+ end
+ | Some (3, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_copy), field(3)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !to__is_set then Pbrt.Decoder.missing_field "to_" end;
+ begin if not !from_is_set then Pbrt.Decoder.missing_field "from" end;
+ ({
+ Vyconf_types.edit_level = v.edit_level;
+ Vyconf_types.from = v.from;
+ Vyconf_types.to_ = v.to_;
+ } : Vyconf_types.request_copy)
let rec decode_request_comment d =
let v = default_request_comment_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let comment_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_comment), field(1)", pk))
- )
- | Some (2, Pbrt.Bytes) -> (
- v.comment <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_comment), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_comment = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_comment), field(1)" pk
+ | Some (2, Pbrt.Bytes) -> begin
+ v.comment <- Pbrt.Decoder.string d; comment_is_set := true;
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_comment), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !comment_is_set then Pbrt.Decoder.missing_field "comment" end;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.comment = v.comment;
+ } : Vyconf_types.request_comment)
let rec decode_request_commit d =
let v = default_request_commit_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Varint) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Varint) -> begin
v.confirm <- Some (Pbrt.Decoder.bool d);
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_commit), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_commit), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
v.confirm_timeout <- Some (Pbrt.Decoder.int32_as_varint d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_commit), field(2)", pk))
- )
- | Some (3, Pbrt.Bytes) -> (
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_commit), field(2)" pk
+ | Some (3, Pbrt.Bytes) -> begin
v.comment <- Some (Pbrt.Decoder.string d);
- loop ()
- )
- | Some (3, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_commit), field(3)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_commit = Obj.magic v in
- v
+ end
+ | Some (3, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_commit), field(3)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.confirm = v.confirm;
+ Vyconf_types.confirm_timeout = v.confirm_timeout;
+ Vyconf_types.comment = v.comment;
+ } : Vyconf_types.request_commit)
let rec decode_request_rollback d =
let v = default_request_rollback_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let revision_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Varint) -> (
- v.revision <- Pbrt.Decoder.int32_as_varint d;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_rollback), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_rollback = Obj.magic v in
- v
+ ); continue__ := false
+ | Some (1, Pbrt.Varint) -> begin
+ v.revision <- Pbrt.Decoder.int32_as_varint d; revision_is_set := true;
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_rollback), field(1)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !revision_is_set then Pbrt.Decoder.missing_field "revision" end;
+ ({
+ Vyconf_types.revision = v.revision;
+ } : Vyconf_types.request_rollback)
let rec decode_request_load d =
let v = default_request_load_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let location_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Bytes) -> (
- v.location <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_load), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
+ v.location <- Pbrt.Decoder.string d; location_is_set := true;
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_load), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
v.format <- Some (decode_request_config_format d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_load), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_load = Obj.magic v in
- v
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_load), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !location_is_set then Pbrt.Decoder.missing_field "location" end;
+ ({
+ Vyconf_types.location = v.location;
+ Vyconf_types.format = v.format;
+ } : Vyconf_types.request_load)
let rec decode_request_merge d =
let v = default_request_merge_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let location_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Bytes) -> (
- v.location <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_merge), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
+ v.location <- Pbrt.Decoder.string d; location_is_set := true;
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_merge), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
v.format <- Some (decode_request_config_format d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_merge), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_merge = Obj.magic v in
- v
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_merge), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !location_is_set then Pbrt.Decoder.missing_field "location" end;
+ ({
+ Vyconf_types.location = v.location;
+ Vyconf_types.format = v.format;
+ } : Vyconf_types.request_merge)
let rec decode_request_save d =
let v = default_request_save_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let location_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Bytes) -> (
- v.location <- Pbrt.Decoder.string d;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_save), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
+ v.location <- Pbrt.Decoder.string d; location_is_set := true;
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_save), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
v.format <- Some (decode_request_config_format d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_save), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_save = Obj.magic v in
- v
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_save), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !location_is_set then Pbrt.Decoder.missing_field "location" end;
+ ({
+ Vyconf_types.location = v.location;
+ Vyconf_types.format = v.format;
+ } : Vyconf_types.request_save)
let rec decode_request_show_config d =
let v = default_request_show_config_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_show_config), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_show_config), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
v.format <- Some (decode_request_config_format d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_show_config), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_show_config = Obj.magic v in
- v
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_show_config), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.format = v.format;
+ } : Vyconf_types.request_show_config)
let rec decode_request_exists d =
let v = default_request_exists_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_exists), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_exists = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_exists), field(1)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ } : Vyconf_types.request_exists)
let rec decode_request_get_value d =
let v = default_request_get_value_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_get_value), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_get_value = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_get_value), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
+ v.output_format <- Some (decode_request_output_format d);
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_get_value), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.output_format = v.output_format;
+ } : Vyconf_types.request_get_value)
let rec decode_request_get_values d =
let v = default_request_get_values_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_get_values), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_get_values = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_get_values), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
+ v.output_format <- Some (decode_request_output_format d);
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_get_values), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.output_format = v.output_format;
+ } : Vyconf_types.request_get_values)
let rec decode_request_list_children d =
let v = default_request_list_children_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_list_children), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_list_children = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_list_children), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
+ v.output_format <- Some (decode_request_output_format d);
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_list_children), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.output_format = v.output_format;
+ } : Vyconf_types.request_list_children)
let rec decode_request_run_op_mode d =
let v = default_request_run_op_mode_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
v.path <- List.rev v.path;
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.path <- (Pbrt.Decoder.string d) :: v.path;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_run_op_mode), field(1)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_run_op_mode = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_run_op_mode), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
+ v.output_format <- Some (decode_request_output_format d);
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_run_op_mode), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ ({
+ Vyconf_types.path = v.path;
+ Vyconf_types.output_format = v.output_format;
+ } : Vyconf_types.request_run_op_mode)
let rec decode_request_enter_configuration_mode d =
let v = default_request_enter_configuration_mode_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let override_exclusive_is_set = ref false in
+ let exclusive_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Varint) -> (
- v.exclusive <- Pbrt.Decoder.bool d;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_enter_configuration_mode), field(1)", pk))
- )
- | Some (2, Pbrt.Varint) -> (
- v.override_exclusive <- Pbrt.Decoder.bool d;
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_enter_configuration_mode), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_enter_configuration_mode = Obj.magic v in
- v
+ ); continue__ := false
+ | Some (1, Pbrt.Varint) -> begin
+ v.exclusive <- Pbrt.Decoder.bool d; exclusive_is_set := true;
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_enter_configuration_mode), field(1)" pk
+ | Some (2, Pbrt.Varint) -> begin
+ v.override_exclusive <- Pbrt.Decoder.bool d; override_exclusive_is_set := true;
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_enter_configuration_mode), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !override_exclusive_is_set then Pbrt.Decoder.missing_field "override_exclusive" end;
+ begin if not !exclusive_is_set then Pbrt.Decoder.missing_field "exclusive" end;
+ ({
+ Vyconf_types.exclusive = v.exclusive;
+ Vyconf_types.override_exclusive = v.override_exclusive;
+ } : Vyconf_types.request_enter_configuration_mode)
let rec decode_request d =
let rec loop () =
- let ret:request = match Pbrt.Decoder.key d with
- | None -> failwith "None of the known key is found"
- | Some (1, _) -> (Pbrt.Decoder.empty_nested d ; Status)
- | Some (2, _) -> Setup_session (decode_request_setup_session (Pbrt.Decoder.nested d))
- | Some (3, _) -> Set (decode_request_set (Pbrt.Decoder.nested d))
- | Some (4, _) -> Delete (decode_request_delete (Pbrt.Decoder.nested d))
- | Some (5, _) -> Rename (decode_request_rename (Pbrt.Decoder.nested d))
- | Some (6, _) -> Copy (decode_request_copy (Pbrt.Decoder.nested d))
- | Some (7, _) -> Comment (decode_request_comment (Pbrt.Decoder.nested d))
- | Some (8, _) -> Commit (decode_request_commit (Pbrt.Decoder.nested d))
- | Some (9, _) -> Rollback (decode_request_rollback (Pbrt.Decoder.nested d))
- | Some (10, _) -> Merge (decode_request_merge (Pbrt.Decoder.nested d))
- | Some (11, _) -> Save (decode_request_save (Pbrt.Decoder.nested d))
- | Some (12, _) -> Show_config (decode_request_show_config (Pbrt.Decoder.nested d))
- | Some (13, _) -> Exists (decode_request_exists (Pbrt.Decoder.nested d))
- | Some (14, _) -> Get_value (decode_request_get_value (Pbrt.Decoder.nested d))
- | Some (15, _) -> Get_values (decode_request_get_values (Pbrt.Decoder.nested d))
- | Some (16, _) -> List_children (decode_request_list_children (Pbrt.Decoder.nested d))
- | Some (17, _) -> Run_op_mode (decode_request_run_op_mode (Pbrt.Decoder.nested d))
- | Some (18, _) -> (Pbrt.Decoder.empty_nested d ; Confirm)
- | Some (19, _) -> Configure (decode_request_enter_configuration_mode (Pbrt.Decoder.nested d))
- | Some (20, _) -> (Pbrt.Decoder.empty_nested d ; Exit_configure)
- | Some (21, _) -> Teardown (Pbrt.Decoder.string d)
+ let ret:Vyconf_types.request = match Pbrt.Decoder.key d with
+ | None -> Pbrt.Decoder.malformed_variant "request"
+ | Some (1, _) -> (Pbrt.Decoder.empty_nested d ; Vyconf_types.Status)
+ | Some (2, _) -> Vyconf_types.Setup_session (decode_request_setup_session (Pbrt.Decoder.nested d))
+ | Some (3, _) -> Vyconf_types.Set (decode_request_set (Pbrt.Decoder.nested d))
+ | Some (4, _) -> Vyconf_types.Delete (decode_request_delete (Pbrt.Decoder.nested d))
+ | Some (5, _) -> Vyconf_types.Rename (decode_request_rename (Pbrt.Decoder.nested d))
+ | Some (6, _) -> Vyconf_types.Copy (decode_request_copy (Pbrt.Decoder.nested d))
+ | Some (7, _) -> Vyconf_types.Comment (decode_request_comment (Pbrt.Decoder.nested d))
+ | Some (8, _) -> Vyconf_types.Commit (decode_request_commit (Pbrt.Decoder.nested d))
+ | Some (9, _) -> Vyconf_types.Rollback (decode_request_rollback (Pbrt.Decoder.nested d))
+ | Some (10, _) -> Vyconf_types.Merge (decode_request_merge (Pbrt.Decoder.nested d))
+ | Some (11, _) -> Vyconf_types.Save (decode_request_save (Pbrt.Decoder.nested d))
+ | Some (12, _) -> Vyconf_types.Show_config (decode_request_show_config (Pbrt.Decoder.nested d))
+ | Some (13, _) -> Vyconf_types.Exists (decode_request_exists (Pbrt.Decoder.nested d))
+ | Some (14, _) -> Vyconf_types.Get_value (decode_request_get_value (Pbrt.Decoder.nested d))
+ | Some (15, _) -> Vyconf_types.Get_values (decode_request_get_values (Pbrt.Decoder.nested d))
+ | Some (16, _) -> Vyconf_types.List_children (decode_request_list_children (Pbrt.Decoder.nested d))
+ | Some (17, _) -> Vyconf_types.Run_op_mode (decode_request_run_op_mode (Pbrt.Decoder.nested d))
+ | Some (18, _) -> (Pbrt.Decoder.empty_nested d ; Vyconf_types.Confirm)
+ | Some (19, _) -> Vyconf_types.Configure (decode_request_enter_configuration_mode (Pbrt.Decoder.nested d))
+ | Some (20, _) -> (Pbrt.Decoder.empty_nested d ; Vyconf_types.Exit_configure)
+ | Some (21, _) -> Vyconf_types.Teardown (Pbrt.Decoder.string d)
| Some (n, payload_kind) -> (
Pbrt.Decoder.skip d payload_kind;
loop ()
@@ -987,644 +718,404 @@ let rec decode_request d =
let rec decode_request_envelope d =
let v = default_request_envelope_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let request_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Bytes) -> begin
v.token <- Some (Pbrt.Decoder.string d);
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_envelope), field(1)", pk))
- )
- | Some (2, Pbrt.Bytes) -> (
- v.request <- decode_request (Pbrt.Decoder.nested d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_envelope), field(2)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:request_envelope = Obj.magic v in
- v
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_envelope), field(1)" pk
+ | Some (2, Pbrt.Bytes) -> begin
+ v.request <- decode_request (Pbrt.Decoder.nested d); request_is_set := true;
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(request_envelope), field(2)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !request_is_set then Pbrt.Decoder.missing_field "request" end;
+ ({
+ Vyconf_types.token = v.token;
+ Vyconf_types.request = v.request;
+ } : Vyconf_types.request_envelope)
let rec decode_status d =
match Pbrt.Decoder.int_as_varint d with
- | 0 -> (Success:status)
- | 1 -> (Fail:status)
- | 2 -> (Invalid_path:status)
- | 3 -> (Invalid_value:status)
- | 4 -> (Commit_in_progress:status)
- | 5 -> (Configuration_locked:status)
- | 6 -> (Internal_error:status)
- | 7 -> (Permission_denied:status)
- | 8 -> (Path_already_exists:status)
- | _ -> failwith "Unknown value for enum status"
+ | 0 -> (Vyconf_types.Success:Vyconf_types.status)
+ | 1 -> (Vyconf_types.Fail:Vyconf_types.status)
+ | 2 -> (Vyconf_types.Invalid_path:Vyconf_types.status)
+ | 3 -> (Vyconf_types.Invalid_value:Vyconf_types.status)
+ | 4 -> (Vyconf_types.Commit_in_progress:Vyconf_types.status)
+ | 5 -> (Vyconf_types.Configuration_locked:Vyconf_types.status)
+ | 6 -> (Vyconf_types.Internal_error:Vyconf_types.status)
+ | 7 -> (Vyconf_types.Permission_denied:Vyconf_types.status)
+ | 8 -> (Vyconf_types.Path_already_exists:Vyconf_types.status)
+ | _ -> Pbrt.Decoder.malformed_variant "status"
let rec decode_response d =
let v = default_response_mutable () in
- let rec loop () =
+ let continue__= ref true in
+ let status_is_set = ref false in
+ while !continue__ do
match Pbrt.Decoder.key d with
| None -> (
- )
- | Some (1, Pbrt.Varint) -> (
- v.status <- decode_status d;
- loop ()
- )
- | Some (1, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(1)", pk))
- )
- | Some (2, Pbrt.Bytes) -> (
+ ); continue__ := false
+ | Some (1, Pbrt.Varint) -> begin
+ v.status <- decode_status d; status_is_set := true;
+ end
+ | Some (1, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(response), field(1)" pk
+ | Some (2, Pbrt.Bytes) -> begin
v.output <- Some (Pbrt.Decoder.string d);
- loop ()
- )
- | Some (2, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(2)", pk))
- )
- | Some (3, Pbrt.Bytes) -> (
+ end
+ | Some (2, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(response), field(2)" pk
+ | Some (3, Pbrt.Bytes) -> begin
v.error <- Some (Pbrt.Decoder.string d);
- loop ()
- )
- | Some (3, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(3)", pk))
- )
- | Some (4, Pbrt.Bytes) -> (
+ end
+ | Some (3, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(response), field(3)" pk
+ | Some (4, Pbrt.Bytes) -> begin
v.warning <- Some (Pbrt.Decoder.string d);
- loop ()
- )
- | Some (4, pk) -> raise (
- Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(4)", pk))
- )
- | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop ()
- in
- loop ();
- let v:response = Obj.magic v in
- v
+ end
+ | Some (4, pk) ->
+ Pbrt.Decoder.unexpected_payload "Message(response), field(4)" pk
+ | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
+ done;
+ begin if not !status_is_set then Pbrt.Decoder.missing_field "status" end;
+ ({
+ Vyconf_types.status = v.status;
+ Vyconf_types.output = v.output;
+ Vyconf_types.error = v.error;
+ Vyconf_types.warning = v.warning;
+ } : Vyconf_types.response)
+
+let rec encode_request_config_format (v:Vyconf_types.request_config_format) encoder =
+ match v with
+ | Vyconf_types.Curly -> Pbrt.Encoder.int_as_varint (0) encoder
+ | Vyconf_types.Json -> Pbrt.Encoder.int_as_varint 1 encoder
-let rec encode_request_config_format (v:request_config_format) encoder =
+let rec encode_request_output_format (v:Vyconf_types.request_output_format) encoder =
match v with
- | Curly -> Pbrt.Encoder.int_as_varint (0) encoder
- | Json -> Pbrt.Encoder.int_as_varint 1 encoder
-
-let rec encode_request_setup_session (v:request_setup_session) encoder =
- (
- match v.client_application with
- | Some x -> (
- Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string x encoder;
- )
- | None -> ();
- );
- (
- match v.on_behalf_of with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- Pbrt.Encoder.int32_as_varint x encoder;
- )
- | None -> ();
- );
+ | Vyconf_types.Out_plain -> Pbrt.Encoder.int_as_varint (0) encoder
+ | Vyconf_types.Out_json -> Pbrt.Encoder.int_as_varint 1 encoder
+
+let rec encode_request_setup_session (v:Vyconf_types.request_setup_session) encoder =
+ begin match v.Vyconf_types.client_application with
+ | Some x ->
+ Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
+ Pbrt.Encoder.string x encoder;
+ | None -> ();
+ end;
+ begin match v.Vyconf_types.on_behalf_of with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ Pbrt.Encoder.int32_as_varint x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_set (v:request_set) encoder =
+let rec encode_request_set (v:Vyconf_types.request_set) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
- (
- match v.ephemeral with
- | Some x -> (
- Pbrt.Encoder.key (3, Pbrt.Varint) encoder;
- Pbrt.Encoder.bool x encoder;
- )
- | None -> ();
- );
+ ) v.Vyconf_types.path;
+ begin match v.Vyconf_types.ephemeral with
+ | Some x ->
+ Pbrt.Encoder.key (3, Pbrt.Varint) encoder;
+ Pbrt.Encoder.bool x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_delete (v:request_delete) encoder =
+let rec encode_request_delete (v:Vyconf_types.request_delete) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
()
-let rec encode_request_rename (v:request_rename) encoder =
+let rec encode_request_rename (v:Vyconf_types.request_rename) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.edit_level;
+ ) v.Vyconf_types.edit_level;
Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.from encoder;
+ Pbrt.Encoder.string v.Vyconf_types.from encoder;
Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.to_ encoder;
+ Pbrt.Encoder.string v.Vyconf_types.to_ encoder;
()
-let rec encode_request_copy (v:request_copy) encoder =
+let rec encode_request_copy (v:Vyconf_types.request_copy) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.edit_level;
+ ) v.Vyconf_types.edit_level;
Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.from encoder;
+ Pbrt.Encoder.string v.Vyconf_types.from encoder;
Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.to_ encoder;
+ Pbrt.Encoder.string v.Vyconf_types.to_ encoder;
()
-let rec encode_request_comment (v:request_comment) encoder =
+let rec encode_request_comment (v:Vyconf_types.request_comment) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.comment encoder;
+ Pbrt.Encoder.string v.Vyconf_types.comment encoder;
()
-let rec encode_request_commit (v:request_commit) encoder =
- (
- match v.confirm with
- | Some x -> (
- Pbrt.Encoder.key (1, Pbrt.Varint) encoder;
- Pbrt.Encoder.bool x encoder;
- )
- | None -> ();
- );
- (
- match v.confirm_timeout with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- Pbrt.Encoder.int32_as_varint x encoder;
- )
- | None -> ();
- );
- (
- match v.comment with
- | Some x -> (
- Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string x encoder;
- )
- | None -> ();
- );
+let rec encode_request_commit (v:Vyconf_types.request_commit) encoder =
+ begin match v.Vyconf_types.confirm with
+ | Some x ->
+ Pbrt.Encoder.key (1, Pbrt.Varint) encoder;
+ Pbrt.Encoder.bool x encoder;
+ | None -> ();
+ end;
+ begin match v.Vyconf_types.confirm_timeout with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ Pbrt.Encoder.int32_as_varint x encoder;
+ | None -> ();
+ end;
+ begin match v.Vyconf_types.comment with
+ | Some x ->
+ Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
+ Pbrt.Encoder.string x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_rollback (v:request_rollback) encoder =
+let rec encode_request_rollback (v:Vyconf_types.request_rollback) encoder =
Pbrt.Encoder.key (1, Pbrt.Varint) encoder;
- Pbrt.Encoder.int32_as_varint v.revision encoder;
+ Pbrt.Encoder.int32_as_varint v.Vyconf_types.revision encoder;
()
-let rec encode_request_load (v:request_load) encoder =
+let rec encode_request_load (v:Vyconf_types.request_load) encoder =
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.location encoder;
- (
- match v.format with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- encode_request_config_format x encoder;
- )
- | None -> ();
- );
+ Pbrt.Encoder.string v.Vyconf_types.location encoder;
+ begin match v.Vyconf_types.format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_config_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_merge (v:request_merge) encoder =
+let rec encode_request_merge (v:Vyconf_types.request_merge) encoder =
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.location encoder;
- (
- match v.format with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- encode_request_config_format x encoder;
- )
- | None -> ();
- );
+ Pbrt.Encoder.string v.Vyconf_types.location encoder;
+ begin match v.Vyconf_types.format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_config_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_save (v:request_save) encoder =
+let rec encode_request_save (v:Vyconf_types.request_save) encoder =
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string v.location encoder;
- (
- match v.format with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- encode_request_config_format x encoder;
- )
- | None -> ();
- );
+ Pbrt.Encoder.string v.Vyconf_types.location encoder;
+ begin match v.Vyconf_types.format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_config_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_show_config (v:request_show_config) encoder =
+let rec encode_request_show_config (v:Vyconf_types.request_show_config) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
- (
- match v.format with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- encode_request_config_format x encoder;
- )
- | None -> ();
- );
+ ) v.Vyconf_types.path;
+ begin match v.Vyconf_types.format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_config_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_exists (v:request_exists) encoder =
+let rec encode_request_exists (v:Vyconf_types.request_exists) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
()
-let rec encode_request_get_value (v:request_get_value) encoder =
+let rec encode_request_get_value (v:Vyconf_types.request_get_value) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
+ begin match v.Vyconf_types.output_format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_output_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_get_values (v:request_get_values) encoder =
+let rec encode_request_get_values (v:Vyconf_types.request_get_values) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
+ begin match v.Vyconf_types.output_format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_output_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_list_children (v:request_list_children) encoder =
+let rec encode_request_list_children (v:Vyconf_types.request_list_children) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
+ begin match v.Vyconf_types.output_format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_output_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_run_op_mode (v:request_run_op_mode) encoder =
+let rec encode_request_run_op_mode (v:Vyconf_types.request_run_op_mode) encoder =
List.iter (fun x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- ) v.path;
+ ) v.Vyconf_types.path;
+ begin match v.Vyconf_types.output_format with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
+ encode_request_output_format x encoder;
+ | None -> ();
+ end;
()
-let rec encode_request_enter_configuration_mode (v:request_enter_configuration_mode) encoder =
+let rec encode_request_enter_configuration_mode (v:Vyconf_types.request_enter_configuration_mode) encoder =
Pbrt.Encoder.key (1, Pbrt.Varint) encoder;
- Pbrt.Encoder.bool v.exclusive encoder;
+ Pbrt.Encoder.bool v.Vyconf_types.exclusive encoder;
Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
- Pbrt.Encoder.bool v.override_exclusive encoder;
+ Pbrt.Encoder.bool v.Vyconf_types.override_exclusive encoder;
()
-let rec encode_request (v:request) encoder =
- match v with
- | Status -> (
+let rec encode_request (v:Vyconf_types.request) encoder =
+ begin match v with
+ | Vyconf_types.Status ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.empty_nested encoder
- )
- | Setup_session x -> (
+ | Vyconf_types.Setup_session x ->
Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_setup_session x) encoder;
- )
- | Set x -> (
+ | Vyconf_types.Set x ->
Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_set x) encoder;
- )
- | Delete x -> (
+ | Vyconf_types.Delete x ->
Pbrt.Encoder.key (4, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_delete x) encoder;
- )
- | Rename x -> (
+ | Vyconf_types.Rename x ->
Pbrt.Encoder.key (5, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_rename x) encoder;
- )
- | Copy x -> (
+ | Vyconf_types.Copy x ->
Pbrt.Encoder.key (6, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_copy x) encoder;
- )
- | Comment x -> (
+ | Vyconf_types.Comment x ->
Pbrt.Encoder.key (7, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_comment x) encoder;
- )
- | Commit x -> (
+ | Vyconf_types.Commit x ->
Pbrt.Encoder.key (8, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_commit x) encoder;
- )
- | Rollback x -> (
+ | Vyconf_types.Rollback x ->
Pbrt.Encoder.key (9, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_rollback x) encoder;
- )
- | Merge x -> (
+ | Vyconf_types.Merge x ->
Pbrt.Encoder.key (10, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_merge x) encoder;
- )
- | Save x -> (
+ | Vyconf_types.Save x ->
Pbrt.Encoder.key (11, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_save x) encoder;
- )
- | Show_config x -> (
+ | Vyconf_types.Show_config x ->
Pbrt.Encoder.key (12, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_show_config x) encoder;
- )
- | Exists x -> (
+ | Vyconf_types.Exists x ->
Pbrt.Encoder.key (13, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_exists x) encoder;
- )
- | Get_value x -> (
+ | Vyconf_types.Get_value x ->
Pbrt.Encoder.key (14, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_get_value x) encoder;
- )
- | Get_values x -> (
+ | Vyconf_types.Get_values x ->
Pbrt.Encoder.key (15, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_get_values x) encoder;
- )
- | List_children x -> (
+ | Vyconf_types.List_children x ->
Pbrt.Encoder.key (16, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_list_children x) encoder;
- )
- | Run_op_mode x -> (
+ | Vyconf_types.Run_op_mode x ->
Pbrt.Encoder.key (17, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_run_op_mode x) encoder;
- )
- | Confirm -> (
+ | Vyconf_types.Confirm ->
Pbrt.Encoder.key (18, Pbrt.Bytes) encoder;
Pbrt.Encoder.empty_nested encoder
- )
- | Configure x -> (
+ | Vyconf_types.Configure x ->
Pbrt.Encoder.key (19, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_request_enter_configuration_mode x) encoder;
- )
- | Exit_configure -> (
+ | Vyconf_types.Exit_configure ->
Pbrt.Encoder.key (20, Pbrt.Bytes) encoder;
Pbrt.Encoder.empty_nested encoder
- )
- | Teardown x -> (
+ | Vyconf_types.Teardown x ->
Pbrt.Encoder.key (21, Pbrt.Bytes) encoder;
Pbrt.Encoder.string x encoder;
- )
-
-let rec encode_request_envelope (v:request_envelope) encoder =
- (
- match v.token with
- | Some x -> (
- Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string x encoder;
- )
- | None -> ();
- );
+ end
+
+let rec encode_request_envelope (v:Vyconf_types.request_envelope) encoder =
+ begin match v.Vyconf_types.token with
+ | Some x ->
+ Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
+ Pbrt.Encoder.string x encoder;
+ | None -> ();
+ end;
Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
- Pbrt.Encoder.nested (encode_request v.request) encoder;
+ Pbrt.Encoder.nested (encode_request v.Vyconf_types.request) encoder;
()
-let rec encode_status (v:status) encoder =
+let rec encode_status (v:Vyconf_types.status) encoder =
match v with
- | Success -> Pbrt.Encoder.int_as_varint (0) encoder
- | Fail -> Pbrt.Encoder.int_as_varint 1 encoder
- | Invalid_path -> Pbrt.Encoder.int_as_varint 2 encoder
- | Invalid_value -> Pbrt.Encoder.int_as_varint 3 encoder
- | Commit_in_progress -> Pbrt.Encoder.int_as_varint 4 encoder
- | Configuration_locked -> Pbrt.Encoder.int_as_varint 5 encoder
- | Internal_error -> Pbrt.Encoder.int_as_varint 6 encoder
- | Permission_denied -> Pbrt.Encoder.int_as_varint 7 encoder
- | Path_already_exists -> Pbrt.Encoder.int_as_varint 8 encoder
-
-let rec encode_response (v:response) encoder =
+ | Vyconf_types.Success -> Pbrt.Encoder.int_as_varint (0) encoder
+ | Vyconf_types.Fail -> Pbrt.Encoder.int_as_varint 1 encoder
+ | Vyconf_types.Invalid_path -> Pbrt.Encoder.int_as_varint 2 encoder
+ | Vyconf_types.Invalid_value -> Pbrt.Encoder.int_as_varint 3 encoder
+ | Vyconf_types.Commit_in_progress -> Pbrt.Encoder.int_as_varint 4 encoder
+ | Vyconf_types.Configuration_locked -> Pbrt.Encoder.int_as_varint 5 encoder
+ | Vyconf_types.Internal_error -> Pbrt.Encoder.int_as_varint 6 encoder
+ | Vyconf_types.Permission_denied -> Pbrt.Encoder.int_as_varint 7 encoder
+ | Vyconf_types.Path_already_exists -> Pbrt.Encoder.int_as_varint 8 encoder
+
+let rec encode_response (v:Vyconf_types.response) encoder =
Pbrt.Encoder.key (1, Pbrt.Varint) encoder;
- encode_status v.status encoder;
- (
- match v.output with
- | Some x -> (
- Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string x encoder;
- )
- | None -> ();
- );
- (
- match v.error with
- | Some x -> (
- Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string x encoder;
- )
- | None -> ();
- );
- (
- match v.warning with
- | Some x -> (
- Pbrt.Encoder.key (4, Pbrt.Bytes) encoder;
- Pbrt.Encoder.string x encoder;
- )
- | None -> ();
- );
+ encode_status v.Vyconf_types.status encoder;
+ begin match v.Vyconf_types.output with
+ | Some x ->
+ Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
+ Pbrt.Encoder.string x encoder;
+ | None -> ();
+ end;
+ begin match v.Vyconf_types.error with
+ | Some x ->
+ Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
+ Pbrt.Encoder.string x encoder;
+ | None -> ();
+ end;
+ begin match v.Vyconf_types.warning with
+ | Some x ->
+ Pbrt.Encoder.key (4, Pbrt.Bytes) encoder;
+ Pbrt.Encoder.string x encoder;
+ | None -> ();
+ end;
()
-
-let rec pp_request_config_format fmt (v:request_config_format) =
- match v with
- | Curly -> Format.fprintf fmt "Curly"
- | Json -> Format.fprintf fmt "Json"
-
-let rec pp_request_setup_session fmt (v:request_setup_session) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "client_application" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.client_application;
- Pbrt.Pp.pp_record_field "on_behalf_of" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.on_behalf_of;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_set fmt (v:request_set) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Pbrt.Pp.pp_record_field "ephemeral" (Pbrt.Pp.pp_option Pbrt.Pp.pp_bool) fmt v.ephemeral;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_delete fmt (v:request_delete) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_rename fmt (v:request_rename) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "edit_level" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.edit_level;
- Pbrt.Pp.pp_record_field "from" Pbrt.Pp.pp_string fmt v.from;
- Pbrt.Pp.pp_record_field "to_" Pbrt.Pp.pp_string fmt v.to_;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_copy fmt (v:request_copy) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "edit_level" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.edit_level;
- Pbrt.Pp.pp_record_field "from" Pbrt.Pp.pp_string fmt v.from;
- Pbrt.Pp.pp_record_field "to_" Pbrt.Pp.pp_string fmt v.to_;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_comment fmt (v:request_comment) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Pbrt.Pp.pp_record_field "comment" Pbrt.Pp.pp_string fmt v.comment;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_commit fmt (v:request_commit) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "confirm" (Pbrt.Pp.pp_option Pbrt.Pp.pp_bool) fmt v.confirm;
- Pbrt.Pp.pp_record_field "confirm_timeout" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.confirm_timeout;
- Pbrt.Pp.pp_record_field "comment" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.comment;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_rollback fmt (v:request_rollback) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "revision" Pbrt.Pp.pp_int32 fmt v.revision;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_load fmt (v:request_load) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "location" Pbrt.Pp.pp_string fmt v.location;
- Pbrt.Pp.pp_record_field "format" (Pbrt.Pp.pp_option pp_request_config_format) fmt v.format;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_merge fmt (v:request_merge) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "location" Pbrt.Pp.pp_string fmt v.location;
- Pbrt.Pp.pp_record_field "format" (Pbrt.Pp.pp_option pp_request_config_format) fmt v.format;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_save fmt (v:request_save) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "location" Pbrt.Pp.pp_string fmt v.location;
- Pbrt.Pp.pp_record_field "format" (Pbrt.Pp.pp_option pp_request_config_format) fmt v.format;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_show_config fmt (v:request_show_config) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Pbrt.Pp.pp_record_field "format" (Pbrt.Pp.pp_option pp_request_config_format) fmt v.format;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_exists fmt (v:request_exists) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_get_value fmt (v:request_get_value) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_get_values fmt (v:request_get_values) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_list_children fmt (v:request_list_children) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_run_op_mode fmt (v:request_run_op_mode) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "path" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.path;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request_enter_configuration_mode fmt (v:request_enter_configuration_mode) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "exclusive" Pbrt.Pp.pp_bool fmt v.exclusive;
- Pbrt.Pp.pp_record_field "override_exclusive" Pbrt.Pp.pp_bool fmt v.override_exclusive;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_request fmt (v:request) =
- match v with
- | Status -> Format.fprintf fmt "Status"
- | Setup_session x -> Format.fprintf fmt "@[Setup_session(%a)@]" pp_request_setup_session x
- | Set x -> Format.fprintf fmt "@[Set(%a)@]" pp_request_set x
- | Delete x -> Format.fprintf fmt "@[Delete(%a)@]" pp_request_delete x
- | Rename x -> Format.fprintf fmt "@[Rename(%a)@]" pp_request_rename x
- | Copy x -> Format.fprintf fmt "@[Copy(%a)@]" pp_request_copy x
- | Comment x -> Format.fprintf fmt "@[Comment(%a)@]" pp_request_comment x
- | Commit x -> Format.fprintf fmt "@[Commit(%a)@]" pp_request_commit x
- | Rollback x -> Format.fprintf fmt "@[Rollback(%a)@]" pp_request_rollback x
- | Merge x -> Format.fprintf fmt "@[Merge(%a)@]" pp_request_merge x
- | Save x -> Format.fprintf fmt "@[Save(%a)@]" pp_request_save x
- | Show_config x -> Format.fprintf fmt "@[Show_config(%a)@]" pp_request_show_config x
- | Exists x -> Format.fprintf fmt "@[Exists(%a)@]" pp_request_exists x
- | Get_value x -> Format.fprintf fmt "@[Get_value(%a)@]" pp_request_get_value x
- | Get_values x -> Format.fprintf fmt "@[Get_values(%a)@]" pp_request_get_values x
- | List_children x -> Format.fprintf fmt "@[List_children(%a)@]" pp_request_list_children x
- | Run_op_mode x -> Format.fprintf fmt "@[Run_op_mode(%a)@]" pp_request_run_op_mode x
- | Confirm -> Format.fprintf fmt "Confirm"
- | Configure x -> Format.fprintf fmt "@[Configure(%a)@]" pp_request_enter_configuration_mode x
- | Exit_configure -> Format.fprintf fmt "Exit_configure"
- | Teardown x -> Format.fprintf fmt "@[Teardown(%a)@]" Pbrt.Pp.pp_string x
-
-let rec pp_request_envelope fmt (v:request_envelope) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "token" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.token;
- Pbrt.Pp.pp_record_field "request" pp_request fmt v.request;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
-
-let rec pp_status fmt (v:status) =
- match v with
- | Success -> Format.fprintf fmt "Success"
- | Fail -> Format.fprintf fmt "Fail"
- | Invalid_path -> Format.fprintf fmt "Invalid_path"
- | Invalid_value -> Format.fprintf fmt "Invalid_value"
- | Commit_in_progress -> Format.fprintf fmt "Commit_in_progress"
- | Configuration_locked -> Format.fprintf fmt "Configuration_locked"
- | Internal_error -> Format.fprintf fmt "Internal_error"
- | Permission_denied -> Format.fprintf fmt "Permission_denied"
- | Path_already_exists -> Format.fprintf fmt "Path_already_exists"
-
-let rec pp_response fmt (v:response) =
- let pp_i fmt () =
- Format.pp_open_vbox fmt 1;
- Pbrt.Pp.pp_record_field "status" pp_status fmt v.status;
- Pbrt.Pp.pp_record_field "output" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.output;
- Pbrt.Pp.pp_record_field "error" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.error;
- Pbrt.Pp.pp_record_field "warning" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.warning;
- Format.pp_close_box fmt ()
- in
- Pbrt.Pp.pp_brk pp_i fmt ()
diff --git a/src/vyconf_pb.mli b/src/vyconf_pb.mli
index 8205491..8a1249c 100644
--- a/src/vyconf_pb.mli
+++ b/src/vyconf_pb.mli
@@ -1,506 +1,151 @@
-(** vyconf.proto Generated Types and Encoding *)
-
-
-(** {2 Types} *)
-
-type request_config_format =
- | Curly
- | 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;
-}
-
-type request_get_values = {
- path : string list;
-}
-
-type request_list_children = {
- path : string list;
-}
-
-type request_run_op_mode = {
- path : string list;
-}
-
-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_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 ->
- 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 ->
- 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 ->
- 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 ->
- 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] *)
+(** vyconf.proto Binary Encoding *)
-(** {2 Protobuf Decoding} *)
-
-val decode_request_config_format : Pbrt.Decoder.t -> request_config_format
-(** [decode_request_config_format decoder] decodes a [request_config_format] value from [decoder] *)
-
-val decode_request_setup_session : Pbrt.Decoder.t -> request_setup_session
-(** [decode_request_setup_session decoder] decodes a [request_setup_session] value from [decoder] *)
-
-val decode_request_set : Pbrt.Decoder.t -> request_set
-(** [decode_request_set decoder] decodes a [request_set] value from [decoder] *)
-
-val decode_request_delete : Pbrt.Decoder.t -> request_delete
-(** [decode_request_delete decoder] decodes a [request_delete] value from [decoder] *)
-
-val decode_request_rename : Pbrt.Decoder.t -> request_rename
-(** [decode_request_rename decoder] decodes a [request_rename] value from [decoder] *)
-
-val decode_request_copy : Pbrt.Decoder.t -> request_copy
-(** [decode_request_copy decoder] decodes a [request_copy] value from [decoder] *)
-
-val decode_request_comment : Pbrt.Decoder.t -> request_comment
-(** [decode_request_comment decoder] decodes a [request_comment] value from [decoder] *)
-
-val decode_request_commit : Pbrt.Decoder.t -> request_commit
-(** [decode_request_commit decoder] decodes a [request_commit] value from [decoder] *)
-
-val decode_request_rollback : Pbrt.Decoder.t -> request_rollback
-(** [decode_request_rollback decoder] decodes a [request_rollback] value from [decoder] *)
+(** {2 Protobuf Encoding} *)
-val decode_request_load : Pbrt.Decoder.t -> request_load
-(** [decode_request_load decoder] decodes a [request_load] value from [decoder] *)
-
-val decode_request_merge : Pbrt.Decoder.t -> request_merge
-(** [decode_request_merge decoder] decodes a [request_merge] value from [decoder] *)
-
-val decode_request_save : Pbrt.Decoder.t -> request_save
-(** [decode_request_save decoder] decodes a [request_save] value from [decoder] *)
-
-val decode_request_show_config : Pbrt.Decoder.t -> request_show_config
-(** [decode_request_show_config decoder] decodes a [request_show_config] value from [decoder] *)
-
-val decode_request_exists : Pbrt.Decoder.t -> request_exists
-(** [decode_request_exists decoder] decodes a [request_exists] value from [decoder] *)
-
-val decode_request_get_value : Pbrt.Decoder.t -> request_get_value
-(** [decode_request_get_value decoder] decodes a [request_get_value] value from [decoder] *)
-
-val decode_request_get_values : Pbrt.Decoder.t -> request_get_values
-(** [decode_request_get_values decoder] decodes a [request_get_values] value from [decoder] *)
-
-val decode_request_list_children : Pbrt.Decoder.t -> request_list_children
-(** [decode_request_list_children decoder] decodes a [request_list_children] value from [decoder] *)
-
-val decode_request_run_op_mode : Pbrt.Decoder.t -> request_run_op_mode
-(** [decode_request_run_op_mode decoder] decodes a [request_run_op_mode] value from [decoder] *)
-
-val decode_request_enter_configuration_mode : Pbrt.Decoder.t -> request_enter_configuration_mode
-(** [decode_request_enter_configuration_mode decoder] decodes a [request_enter_configuration_mode] value from [decoder] *)
-
-val decode_request : Pbrt.Decoder.t -> request
-(** [decode_request decoder] decodes a [request] value from [decoder] *)
-
-val decode_request_envelope : Pbrt.Decoder.t -> request_envelope
-(** [decode_request_envelope decoder] decodes a [request_envelope] value from [decoder] *)
-
-val decode_status : Pbrt.Decoder.t -> status
-(** [decode_status decoder] decodes a [status] value from [decoder] *)
-
-val decode_response : Pbrt.Decoder.t -> response
-(** [decode_response decoder] decodes a [response] value from [decoder] *)
-
-
-(** {2 Protobuf Toding} *)
-
-val encode_request_config_format : request_config_format -> Pbrt.Encoder.t -> unit
+val encode_request_config_format : Vyconf_types.request_config_format -> Pbrt.Encoder.t -> unit
(** [encode_request_config_format v encoder] encodes [v] with the given [encoder] *)
-val encode_request_setup_session : request_setup_session -> Pbrt.Encoder.t -> unit
+val encode_request_output_format : Vyconf_types.request_output_format -> Pbrt.Encoder.t -> unit
+(** [encode_request_output_format v encoder] encodes [v] with the given [encoder] *)
+
+val encode_request_setup_session : Vyconf_types.request_setup_session -> Pbrt.Encoder.t -> unit
(** [encode_request_setup_session v encoder] encodes [v] with the given [encoder] *)
-val encode_request_set : request_set -> Pbrt.Encoder.t -> unit
+val encode_request_set : Vyconf_types.request_set -> Pbrt.Encoder.t -> unit
(** [encode_request_set v encoder] encodes [v] with the given [encoder] *)
-val encode_request_delete : request_delete -> Pbrt.Encoder.t -> unit
+val encode_request_delete : Vyconf_types.request_delete -> Pbrt.Encoder.t -> unit
(** [encode_request_delete v encoder] encodes [v] with the given [encoder] *)
-val encode_request_rename : request_rename -> Pbrt.Encoder.t -> unit
+val encode_request_rename : Vyconf_types.request_rename -> Pbrt.Encoder.t -> unit
(** [encode_request_rename v encoder] encodes [v] with the given [encoder] *)
-val encode_request_copy : request_copy -> Pbrt.Encoder.t -> unit
+val encode_request_copy : Vyconf_types.request_copy -> Pbrt.Encoder.t -> unit
(** [encode_request_copy v encoder] encodes [v] with the given [encoder] *)
-val encode_request_comment : request_comment -> Pbrt.Encoder.t -> unit
+val encode_request_comment : Vyconf_types.request_comment -> Pbrt.Encoder.t -> unit
(** [encode_request_comment v encoder] encodes [v] with the given [encoder] *)
-val encode_request_commit : request_commit -> Pbrt.Encoder.t -> unit
+val encode_request_commit : Vyconf_types.request_commit -> Pbrt.Encoder.t -> unit
(** [encode_request_commit v encoder] encodes [v] with the given [encoder] *)
-val encode_request_rollback : request_rollback -> Pbrt.Encoder.t -> unit
+val encode_request_rollback : Vyconf_types.request_rollback -> Pbrt.Encoder.t -> unit
(** [encode_request_rollback v encoder] encodes [v] with the given [encoder] *)
-val encode_request_load : request_load -> Pbrt.Encoder.t -> unit
+val encode_request_load : Vyconf_types.request_load -> Pbrt.Encoder.t -> unit
(** [encode_request_load v encoder] encodes [v] with the given [encoder] *)
-val encode_request_merge : request_merge -> Pbrt.Encoder.t -> unit
+val encode_request_merge : Vyconf_types.request_merge -> Pbrt.Encoder.t -> unit
(** [encode_request_merge v encoder] encodes [v] with the given [encoder] *)
-val encode_request_save : request_save -> Pbrt.Encoder.t -> unit
+val encode_request_save : Vyconf_types.request_save -> Pbrt.Encoder.t -> unit
(** [encode_request_save v encoder] encodes [v] with the given [encoder] *)
-val encode_request_show_config : request_show_config -> Pbrt.Encoder.t -> unit
+val encode_request_show_config : Vyconf_types.request_show_config -> Pbrt.Encoder.t -> unit
(** [encode_request_show_config v encoder] encodes [v] with the given [encoder] *)
-val encode_request_exists : request_exists -> Pbrt.Encoder.t -> unit
+val encode_request_exists : Vyconf_types.request_exists -> Pbrt.Encoder.t -> unit
(** [encode_request_exists v encoder] encodes [v] with the given [encoder] *)
-val encode_request_get_value : request_get_value -> Pbrt.Encoder.t -> unit
+val encode_request_get_value : Vyconf_types.request_get_value -> Pbrt.Encoder.t -> unit
(** [encode_request_get_value v encoder] encodes [v] with the given [encoder] *)
-val encode_request_get_values : request_get_values -> Pbrt.Encoder.t -> unit
+val encode_request_get_values : Vyconf_types.request_get_values -> Pbrt.Encoder.t -> unit
(** [encode_request_get_values v encoder] encodes [v] with the given [encoder] *)
-val encode_request_list_children : request_list_children -> Pbrt.Encoder.t -> unit
+val encode_request_list_children : Vyconf_types.request_list_children -> Pbrt.Encoder.t -> unit
(** [encode_request_list_children v encoder] encodes [v] with the given [encoder] *)
-val encode_request_run_op_mode : request_run_op_mode -> Pbrt.Encoder.t -> unit
+val encode_request_run_op_mode : Vyconf_types.request_run_op_mode -> Pbrt.Encoder.t -> unit
(** [encode_request_run_op_mode v encoder] encodes [v] with the given [encoder] *)
-val encode_request_enter_configuration_mode : request_enter_configuration_mode -> Pbrt.Encoder.t -> unit
+val encode_request_enter_configuration_mode : Vyconf_types.request_enter_configuration_mode -> Pbrt.Encoder.t -> unit
(** [encode_request_enter_configuration_mode v encoder] encodes [v] with the given [encoder] *)
-val encode_request : request -> Pbrt.Encoder.t -> unit
+val encode_request : Vyconf_types.request -> Pbrt.Encoder.t -> unit
(** [encode_request v encoder] encodes [v] with the given [encoder] *)
-val encode_request_envelope : request_envelope -> Pbrt.Encoder.t -> unit
+val encode_request_envelope : Vyconf_types.request_envelope -> Pbrt.Encoder.t -> unit
(** [encode_request_envelope v encoder] encodes [v] with the given [encoder] *)
-val encode_status : status -> Pbrt.Encoder.t -> unit
+val encode_status : Vyconf_types.status -> Pbrt.Encoder.t -> unit
(** [encode_status v encoder] encodes [v] with the given [encoder] *)
-val encode_response : response -> Pbrt.Encoder.t -> unit
+val encode_response : Vyconf_types.response -> Pbrt.Encoder.t -> unit
(** [encode_response v encoder] encodes [v] with the given [encoder] *)
-(** {2 Formatters} *)
+(** {2 Protobuf Decoding} *)
-val pp_request_config_format : Format.formatter -> request_config_format -> unit
-(** [pp_request_config_format v] formats v *)
+val decode_request_config_format : Pbrt.Decoder.t -> Vyconf_types.request_config_format
+(** [decode_request_config_format decoder] decodes a [request_config_format] value from [decoder] *)
-val pp_request_setup_session : Format.formatter -> request_setup_session -> unit
-(** [pp_request_setup_session v] formats v *)
+val decode_request_output_format : Pbrt.Decoder.t -> Vyconf_types.request_output_format
+(** [decode_request_output_format decoder] decodes a [request_output_format] value from [decoder] *)
-val pp_request_set : Format.formatter -> request_set -> unit
-(** [pp_request_set v] formats v *)
+val decode_request_setup_session : Pbrt.Decoder.t -> Vyconf_types.request_setup_session
+(** [decode_request_setup_session decoder] decodes a [request_setup_session] value from [decoder] *)
-val pp_request_delete : Format.formatter -> request_delete -> unit
-(** [pp_request_delete v] formats v *)
+val decode_request_set : Pbrt.Decoder.t -> Vyconf_types.request_set
+(** [decode_request_set decoder] decodes a [request_set] value from [decoder] *)
-val pp_request_rename : Format.formatter -> request_rename -> unit
-(** [pp_request_rename v] formats v *)
+val decode_request_delete : Pbrt.Decoder.t -> Vyconf_types.request_delete
+(** [decode_request_delete decoder] decodes a [request_delete] value from [decoder] *)
-val pp_request_copy : Format.formatter -> request_copy -> unit
-(** [pp_request_copy v] formats v *)
+val decode_request_rename : Pbrt.Decoder.t -> Vyconf_types.request_rename
+(** [decode_request_rename decoder] decodes a [request_rename] value from [decoder] *)
-val pp_request_comment : Format.formatter -> request_comment -> unit
-(** [pp_request_comment v] formats v *)
+val decode_request_copy : Pbrt.Decoder.t -> Vyconf_types.request_copy
+(** [decode_request_copy decoder] decodes a [request_copy] value from [decoder] *)
-val pp_request_commit : Format.formatter -> request_commit -> unit
-(** [pp_request_commit v] formats v *)
+val decode_request_comment : Pbrt.Decoder.t -> Vyconf_types.request_comment
+(** [decode_request_comment decoder] decodes a [request_comment] value from [decoder] *)
-val pp_request_rollback : Format.formatter -> request_rollback -> unit
-(** [pp_request_rollback v] formats v *)
+val decode_request_commit : Pbrt.Decoder.t -> Vyconf_types.request_commit
+(** [decode_request_commit decoder] decodes a [request_commit] value from [decoder] *)
-val pp_request_load : Format.formatter -> request_load -> unit
-(** [pp_request_load v] formats v *)
+val decode_request_rollback : Pbrt.Decoder.t -> Vyconf_types.request_rollback
+(** [decode_request_rollback decoder] decodes a [request_rollback] value from [decoder] *)
-val pp_request_merge : Format.formatter -> request_merge -> unit
-(** [pp_request_merge v] formats v *)
+val decode_request_load : Pbrt.Decoder.t -> Vyconf_types.request_load
+(** [decode_request_load decoder] decodes a [request_load] value from [decoder] *)
-val pp_request_save : Format.formatter -> request_save -> unit
-(** [pp_request_save v] formats v *)
+val decode_request_merge : Pbrt.Decoder.t -> Vyconf_types.request_merge
+(** [decode_request_merge decoder] decodes a [request_merge] value from [decoder] *)
-val pp_request_show_config : Format.formatter -> request_show_config -> unit
-(** [pp_request_show_config v] formats v *)
+val decode_request_save : Pbrt.Decoder.t -> Vyconf_types.request_save
+(** [decode_request_save decoder] decodes a [request_save] value from [decoder] *)
+
+val decode_request_show_config : Pbrt.Decoder.t -> Vyconf_types.request_show_config
+(** [decode_request_show_config decoder] decodes a [request_show_config] value from [decoder] *)
-val pp_request_exists : Format.formatter -> request_exists -> unit
-(** [pp_request_exists v] formats v *)
+val decode_request_exists : Pbrt.Decoder.t -> Vyconf_types.request_exists
+(** [decode_request_exists decoder] decodes a [request_exists] value from [decoder] *)
-val pp_request_get_value : Format.formatter -> request_get_value -> unit
-(** [pp_request_get_value v] formats v *)
+val decode_request_get_value : Pbrt.Decoder.t -> Vyconf_types.request_get_value
+(** [decode_request_get_value decoder] decodes a [request_get_value] value from [decoder] *)
-val pp_request_get_values : Format.formatter -> request_get_values -> unit
-(** [pp_request_get_values v] formats v *)
+val decode_request_get_values : Pbrt.Decoder.t -> Vyconf_types.request_get_values
+(** [decode_request_get_values decoder] decodes a [request_get_values] value from [decoder] *)
-val pp_request_list_children : Format.formatter -> request_list_children -> unit
-(** [pp_request_list_children v] formats v *)
+val decode_request_list_children : Pbrt.Decoder.t -> Vyconf_types.request_list_children
+(** [decode_request_list_children decoder] decodes a [request_list_children] value from [decoder] *)
-val pp_request_run_op_mode : Format.formatter -> request_run_op_mode -> unit
-(** [pp_request_run_op_mode v] formats v *)
+val decode_request_run_op_mode : Pbrt.Decoder.t -> Vyconf_types.request_run_op_mode
+(** [decode_request_run_op_mode decoder] decodes a [request_run_op_mode] value from [decoder] *)
-val pp_request_enter_configuration_mode : Format.formatter -> request_enter_configuration_mode -> unit
-(** [pp_request_enter_configuration_mode v] formats v *)
+val decode_request_enter_configuration_mode : Pbrt.Decoder.t -> Vyconf_types.request_enter_configuration_mode
+(** [decode_request_enter_configuration_mode decoder] decodes a [request_enter_configuration_mode] value from [decoder] *)
-val pp_request : Format.formatter -> request -> unit
-(** [pp_request v] formats v *)
+val decode_request : Pbrt.Decoder.t -> Vyconf_types.request
+(** [decode_request decoder] decodes a [request] value from [decoder] *)
-val pp_request_envelope : Format.formatter -> request_envelope -> unit
-(** [pp_request_envelope v] formats v *)
+val decode_request_envelope : Pbrt.Decoder.t -> Vyconf_types.request_envelope
+(** [decode_request_envelope decoder] decodes a [request_envelope] value from [decoder] *)
-val pp_status : Format.formatter -> status -> unit
-(** [pp_status v] formats v *)
+val decode_status : Pbrt.Decoder.t -> Vyconf_types.status
+(** [decode_status decoder] decodes a [status] value from [decoder] *)
-val pp_response : Format.formatter -> response -> unit
-(** [pp_response v] formats v *)
+val decode_response : Pbrt.Decoder.t -> Vyconf_types.response
+(** [decode_response decoder] decodes a [response] value from [decoder] *)
diff --git a/src/vyconf_types.ml b/src/vyconf_types.ml
new file mode 100644
index 0000000..f7e5d50
--- /dev/null
+++ b/src/vyconf_types.ml
@@ -0,0 +1,318 @@
+[@@@ocaml.warning "-27-30-39"]
+
+
+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;
+}
+
+let rec default_request_config_format () = (Curly:request_config_format)
+
+let rec default_request_output_format () = (Out_plain:request_output_format)
+
+let rec default_request_setup_session
+ ?client_application:((client_application:string option) = None)
+ ?on_behalf_of:((on_behalf_of:int32 option) = None)
+ () : request_setup_session = {
+ client_application;
+ on_behalf_of;
+}
+
+let rec default_request_set
+ ?path:((path:string list) = [])
+ ?ephemeral:((ephemeral:bool option) = None)
+ () : request_set = {
+ path;
+ ephemeral;
+}
+
+let rec default_request_delete
+ ?path:((path:string list) = [])
+ () : request_delete = {
+ path;
+}
+
+let rec default_request_rename
+ ?edit_level:((edit_level:string list) = [])
+ ?from:((from:string) = "")
+ ?to_:((to_:string) = "")
+ () : request_rename = {
+ edit_level;
+ from;
+ to_;
+}
+
+let rec default_request_copy
+ ?edit_level:((edit_level:string list) = [])
+ ?from:((from:string) = "")
+ ?to_:((to_:string) = "")
+ () : request_copy = {
+ edit_level;
+ from;
+ to_;
+}
+
+let rec default_request_comment
+ ?path:((path:string list) = [])
+ ?comment:((comment:string) = "")
+ () : request_comment = {
+ path;
+ comment;
+}
+
+let rec default_request_commit
+ ?confirm:((confirm:bool option) = None)
+ ?confirm_timeout:((confirm_timeout:int32 option) = None)
+ ?comment:((comment:string option) = None)
+ () : request_commit = {
+ confirm;
+ confirm_timeout;
+ comment;
+}
+
+let rec default_request_rollback
+ ?revision:((revision:int32) = 0l)
+ () : request_rollback = {
+ revision;
+}
+
+let rec default_request_load
+ ?location:((location:string) = "")
+ ?format:((format:request_config_format option) = None)
+ () : request_load = {
+ location;
+ format;
+}
+
+let rec default_request_merge
+ ?location:((location:string) = "")
+ ?format:((format:request_config_format option) = None)
+ () : request_merge = {
+ location;
+ format;
+}
+
+let rec default_request_save
+ ?location:((location:string) = "")
+ ?format:((format:request_config_format option) = None)
+ () : request_save = {
+ location;
+ format;
+}
+
+let rec default_request_show_config
+ ?path:((path:string list) = [])
+ ?format:((format:request_config_format option) = None)
+ () : request_show_config = {
+ path;
+ format;
+}
+
+let rec default_request_exists
+ ?path:((path:string list) = [])
+ () : request_exists = {
+ path;
+}
+
+let rec default_request_get_value
+ ?path:((path:string list) = [])
+ ?output_format:((output_format:request_output_format option) = None)
+ () : request_get_value = {
+ path;
+ output_format;
+}
+
+let rec default_request_get_values
+ ?path:((path:string list) = [])
+ ?output_format:((output_format:request_output_format option) = None)
+ () : request_get_values = {
+ path;
+ output_format;
+}
+
+let rec default_request_list_children
+ ?path:((path:string list) = [])
+ ?output_format:((output_format:request_output_format option) = None)
+ () : request_list_children = {
+ path;
+ output_format;
+}
+
+let rec default_request_run_op_mode
+ ?path:((path:string list) = [])
+ ?output_format:((output_format:request_output_format option) = None)
+ () : request_run_op_mode = {
+ path;
+ output_format;
+}
+
+let rec default_request_enter_configuration_mode
+ ?exclusive:((exclusive:bool) = false)
+ ?override_exclusive:((override_exclusive:bool) = false)
+ () : request_enter_configuration_mode = {
+ exclusive;
+ override_exclusive;
+}
+
+let rec default_request (): request = Status
+
+let rec default_request_envelope
+ ?token:((token:string option) = None)
+ ?request:((request:request) = default_request ())
+ () : request_envelope = {
+ token;
+ request;
+}
+
+let rec default_status () = (Success:status)
+
+let rec default_response
+ ?status:((status:status) = default_status ())
+ ?output:((output:string option) = None)
+ ?error:((error:string option) = None)
+ ?warning:((warning:string option) = None)
+ () : response = {
+ status;
+ output;
+ error;
+ warning;
+}
diff --git a/src/vyconf_types.mli b/src/vyconf_types.mli
new file mode 100644
index 0000000..194d66c
--- /dev/null
+++ b/src/vyconf_types.mli
@@ -0,0 +1,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] *)