remote: try to use Struct for api

with a catch: password is in the struct but we do not want it to return
via the api, so we only 'serialize' it when the string is not empty
(this can only happen when the format is not checked by us, iow.
when its returned from the api) and setting it manually to ""
when we return remotes from the api

this way we can still use the type but do not return the password

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak authored and Dietmar Maurer committed 2020-05-26 08:55:07 +02:00
1 parent bfa0146c00
commit 83fd4b3b1b
2 files changed
+15 -27

No files matched your search

+1
View File
@@ -59,6 +59,7 @@ pub struct Remote {
pub comment: Option<String>,
pub host: String,
pub userid: String,
#[serde(skip_serializing_if="String::is_empty")]
pub password: String,
#[serde(skip_serializing_if="Option::is_none")]
pub fingerprint: Option<String>,