diff options
Diffstat (limited to 'src/vyconf_client.ml')
-rw-r--r-- | src/vyconf_client.ml | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/vyconf_client.ml b/src/vyconf_client.ml index 5437428..c4811c5 100644 --- a/src/vyconf_client.ml +++ b/src/vyconf_client.ml @@ -48,8 +48,8 @@ let do_request client req = let%lwt resp = Vyconf_connect.Message.read client.ic in decode_pb_response (Pbrt.Decoder.of_bytes resp) |> Lwt.return -let get_status client = - let req = Status in +let prompt client = + let req = Prompt in let%lwt resp = do_request client req in Lwt.return resp @@ -118,6 +118,32 @@ let validate client path = | Fail -> Error (Option.value resp.error ~default:"") |> Lwt.return | _ -> Error (Option.value resp.error ~default:"") |> Lwt.return +let set client path = + let req = Set {path=path;} in + let%lwt resp = do_request client req in + match resp.status with + | Success -> Lwt.return (Ok "") + | Fail -> Error (Option.value resp.error ~default:"") |> Lwt.return + | _ -> Error (Option.value resp.error ~default:"") |> Lwt.return + +let delete client path = + let req = Delete {path=path;} in + let%lwt resp = do_request client req in + match resp.status with + | Success -> Lwt.return (Ok "") + | Fail -> Error (Option.value resp.error ~default:"") |> Lwt.return + | _ -> Error (Option.value resp.error ~default:"") |> Lwt.return + +let commit client = + let req = + Commit {confirm=None; confirm_timeout=None; comment=None; dry_run=None} + in + let%lwt resp = do_request client req in + match resp.status with + | Success -> Ok (Option.value resp.output ~default:"") |> Lwt.return + | Fail -> Error (Option.value resp.error ~default:"") |> Lwt.return + | _ -> Error (Option.value resp.error ~default:"") |> Lwt.return + let reload_reftree ?(on_behalf_of=None) client = let id = on_behalf_of |> (function None -> None | Some x -> (Some (Int32.of_int x))) in let req = Reload_reftree {on_behalf_of=id} in |