]> git.proxmox.com Git - proxmox-backup.git/blame - src/api2/subscription.rs
switch from failure to anyhow
[proxmox-backup.git] / src / api2 / subscription.rs
CommitLineData
f7d4e4b5 1use anyhow::{Error};
7e13b2d6
DM
2use serde_json::{json, Value};
3
1bfc1efa 4use proxmox::api::{api, Router, Permission};
a2479cfa
WB
5
6use crate::tools;
1bfc1efa 7use crate::config::acl::PRIV_SYS_AUDIT;
7e13b2d6 8
1bfc1efa
DM
9#[api(
10 returns: {
11 description: "Subscription status.",
12 properties: {
13 status: {
14 type: String,
15 description: "'NotFound', 'active' or 'inactive'."
16 },
17 message: {
18 type: String,
19 description: "Human readable problem description.",
20 },
21 serverid: {
22 type: String,
23 description: "The unique server ID.",
24 },
25 url: {
26 type: String,
27 description: "URL to Web Shop.",
28 },
29 },
30 },
31 access: {
32 permission: &Permission::Privilege(&[], PRIV_SYS_AUDIT, false),
33 },
34)]
35/// Read subscription info.
36fn get_subscription(_param: Value) -> Result<Value, Error> {
7e13b2d6
DM
37
38 let url = "https://www.proxmox.com/en/proxmox-backup-server/pricing";
39 Ok(json!({
40 "status": "NotFound",
41 "message": "There is no subscription key",
42 "serverid": tools::get_hardware_address()?,
43 "url": url,
44 }))
45}
46
255f378a 47pub const ROUTER: Router = Router::new()
1bfc1efa 48 .get(&API_METHOD_GET_SUBSCRIPTION);