summaryrefslogtreecommitdiff
path: root/src/vyconf_client.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-03-30 15:45:40 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-03-31 00:50:30 -0500
commitc7b81cca1e181103d28ec2493aae67818bc14dd1 (patch)
tree29f835c5fe322831cc2f113a1688ac53a1112eff /src/vyconf_client.ml
parent56b05dc3b8d04de25489b4510ba25efc584ebc7a (diff)
downloadvyconf-c7b81cca1e181103d28ec2493aae67818bc14dd1.tar.gz
vyconf-c7b81cca1e181103d28ec2493aae67818bc14dd1.zip
T7292: add commit request client operations
Diffstat (limited to 'src/vyconf_client.ml')
-rw-r--r--src/vyconf_client.ml24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vyconf_client.ml b/src/vyconf_client.ml
index 5437428..1f00f29 100644
--- a/src/vyconf_client.ml
+++ b/src/vyconf_client.ml
@@ -118,6 +118,30 @@ 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;} 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