2019-01-22 11:50:19 +00:00
|
|
|
use failure::*;
|
|
|
|
use serde_json::{json, Value};
|
|
|
|
|
2020-04-17 13:14:28 +00:00
|
|
|
use proxmox::api::{api, Router, Permission};
|
2019-11-21 13:36:28 +00:00
|
|
|
|
|
|
|
use crate::tools;
|
2020-04-17 13:14:28 +00:00
|
|
|
use crate::config::acl::PRIV_SYS_AUDIT;
|
2019-01-22 11:50:19 +00:00
|
|
|
|
2020-04-17 13:14:28 +00:00
|
|
|
#[api(
|
|
|
|
returns: {
|
|
|
|
description: "Subscription status.",
|
|
|
|
properties: {
|
|
|
|
status: {
|
|
|
|
type: String,
|
|
|
|
description: "'NotFound', 'active' or 'inactive'."
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
type: String,
|
|
|
|
description: "Human readable problem description.",
|
|
|
|
},
|
|
|
|
serverid: {
|
|
|
|
type: String,
|
|
|
|
description: "The unique server ID.",
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
type: String,
|
|
|
|
description: "URL to Web Shop.",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
access: {
|
|
|
|
permission: &Permission::Privilege(&[], PRIV_SYS_AUDIT, false),
|
|
|
|
},
|
|
|
|
)]
|
|
|
|
/// Read subscription info.
|
|
|
|
fn get_subscription(_param: Value) -> Result<Value, Error> {
|
2019-01-22 11:50:19 +00:00
|
|
|
|
|
|
|
let url = "https://www.proxmox.com/en/proxmox-backup-server/pricing";
|
|
|
|
Ok(json!({
|
|
|
|
"status": "NotFound",
|
|
|
|
"message": "There is no subscription key",
|
|
|
|
"serverid": tools::get_hardware_address()?,
|
|
|
|
"url": url,
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
2019-11-21 08:36:41 +00:00
|
|
|
pub const ROUTER: Router = Router::new()
|
2020-04-17 13:14:28 +00:00
|
|
|
.get(&API_METHOD_GET_SUBSCRIPTION);
|