diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-04-01 15:39:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-01 15:39:44 +0100 |
commit | aedecf6fa96509ef59fd2e1f607a8a13c18d214b (patch) | |
tree | 610d48220e115555d1770f9d7631999b3101bd80 /src/vyconf_client.ml | |
parent | 920b75a6dbf9eac4b94600b759818b2ec28004ae (diff) | |
parent | ab010dbe993afc990fafa4525e1a94670ca7f5a4 (diff) | |
download | vyconf-aedecf6fa96509ef59fd2e1f607a8a13c18d214b.tar.gz vyconf-aedecf6fa96509ef59fd2e1f607a8a13c18d214b.zip |
Merge pull request #17 from jestabro/commit-post
T7272: update vyconf config tree on results from commitd
Diffstat (limited to 'src/vyconf_client.ml')
-rw-r--r-- | src/vyconf_client.ml | 24 |
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 |