update api macro invocation to new style

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-11-27 14:19:36 +01:00
parent 314bb35868
commit 7b6c41078b
1 changed files with 28 additions and 27 deletions

View File

@ -36,37 +36,38 @@ fn authenticate_user(username: &str, password: &str) -> Result<(), Error> {
bail!("inavlid credentials"); bail!("inavlid credentials");
} }
#[api] #[api(
#[input({ input: {
properties: { properties: {
username: { username: {
type: String, type: String,
description: "User name.", description: "User name.",
max_length: 64, max_length: 64,
}, },
password: { password: {
type: String, type: String,
description: "The secret password. This can also be a valid ticket.", description: "The secret password. This can also be a valid ticket.",
},
}, },
}, },
})] returns: {
#[returns({ properties: {
properties: { username: {
username: { type: String,
type: String, description: "User name.",
description: "User name.", },
}, ticket: {
ticket: { type: String,
type: String, description: "Auth ticket.",
description: "Auth ticket.", },
}, CSRFPreventionToken: {
CSRFPreventionToken: { type: String,
type: String, description: "Cross Site Request Forgery Prevention Token.",
description: "Cross Site Request Forgery Prevention Token.", },
}, },
}, },
})] protected: true,
#[protected] )]
/// Create or verify authentication ticket. /// Create or verify authentication ticket.
/// ///
/// Returns: An authentication ticket with additional infos. /// Returns: An authentication ticket with additional infos.