by implementing Deref and DerefMut, renaming consume to 'remove_data'
adapt the usage inside of websocket (we did not use it anywhere else for now)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
API_RETURN_* and API_PARAMETER_* schemas are no references
anymore to allow using them as external schemas via the
`"schema"` key inside object schemas inside the `#[api]`
macro.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
The docs say `into_boxed_slice()` "drops" excess capacity,
but doesn't specify whether that just means it becomes
inaccessible or the vector potentially reallocates to the
exact size.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
for now there is a helper for Reading and Writing
still missing is a utility for the handshake/accepting a connection
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
this is a Buffer struct that holds u8 and has convenience methods
for reading onto the back and consuming from the front
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
those can contain percent encoded values, so we have to decode them
before lookin up the path
this is especially important for the 'MatchAll' branch
when the parameter can contain some reserved characters
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
instead of checking on '1' or 'true', check that it is there and not
'0' and 'false'. this allows using simply
https://foo:8007/?debug
instead of
https://foo:8007/?debug=1
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
We get the path to our executable via a readlink() on
"/proc/self/exe", which appends a " (deleted)" during
package reloads.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This way we can use
println!("something: {}", AsHex(bytes));
without having to turn them into an allocated string first.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
and drop the now unused extract_lists function
this also fixes a bug, where we did not add the datastore to the list at
all when there was no rrd data
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
there is now a 'extract_cached_data' which just returns
the data of the specified field, and an api function that converts
a list of fields to the correct serde value
this way we do not have to create a serde value in rrd/cache.rs
(makes for a better interface)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
this is an interface to simply get the Vec<Option<f64>> out of rrd
without going through serde values
we return a list of timestamps and a HashMap with the lists we could find
(otherwise it is not in the map)
if no lists could be extracted, the time list is also empty
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This way read_password() will not write the prompt into
stdout if stdout was redirected into a file, but instead
opens `/dev/tty`.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
when checking a path, we only pushed the components to the checked value
that would contain a parameter and not fixed ones
e.g. from the path components (with params datastore="foo")
["datastore", "{datastore}"]
only ["foo"] was given to the lookup_privs function
instead of ["datastore", "foo"]
this fixes an issue where e.g. a prune on /datastore/foo would fail
for a user that has the role DatastorePowerUser on /datastore (with
propagate) or /datastore/foo
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
add tests for check_api_permission and many Permission combinations
this test fails for now and will be fixed with the next commit
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>