]>
git.proxmox.com Git - proxmox-backup.git/blob - src/server/environment.rs
1 use crate::api_schema
::router
::*;
3 use std
::collections
::HashMap
;
6 pub struct RestEnvironment
{
7 env_type
: RpcEnvironmentType
,
8 result_attributes
: HashMap
<String
, Value
>,
12 impl RestEnvironment
{
13 pub fn new(env_type
: RpcEnvironmentType
) -> Self {
15 result_attributes
: HashMap
::new(),
22 impl RpcEnvironment
for RestEnvironment
{
24 fn set_result_attrib(&mut self, name
: &str, value
: Value
) {
25 self.result_attributes
.insert(name
.into(), value
);
28 fn get_result_attrib(&self, name
: &str) -> Option
<&Value
> {
29 self.result_attributes
.get(name
)
32 fn env_type(&self) -> RpcEnvironmentType
{
36 fn set_user(&mut self, user
: Option
<String
>) {
40 fn get_user(&self) -> Option
<String
> {