Skip to main content

proxmox_api/generated/nodes/node/ceph/cfg/
value.rs

1#[derive(Debug, Clone)]
2pub struct ValueClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> ValueClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/value"),
14        }
15    }
16}
17impl<T> ValueClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Get configured values from either the config file or config DB."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
24    pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
25        let path = self.path.to_string();
26        self.client.get(&path, &params).await
27    }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct GetOutput {
31    #[serde(
32        flatten,
33        default,
34        skip_serializing_if = "::std::collections::HashMap::is_empty"
35    )]
36    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
37}
38impl GetParams {
39    pub fn new(config_keys: ConfigKeysStr) -> Self {
40        Self {
41            config_keys,
42            additional_properties: ::std::default::Default::default(),
43        }
44    }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
47pub struct GetParams {
48    #[serde(rename = "config-keys")]
49    #[doc = "List of \\\\<section\\\\>:\\\\<config key\\\\> items."]
50    #[doc = ""]
51    pub config_keys: ConfigKeysStr,
52    #[serde(
53        flatten,
54        default,
55        skip_serializing_if = "::std::collections::HashMap::is_empty"
56    )]
57    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
58}
59#[derive(Debug, Clone, PartialEq, PartialOrd)]
60pub struct ConfigKeysStr {
61    value: String,
62}
63impl crate::types::bounded_string::BoundedString for ConfigKeysStr {
64    const MIN_LENGTH: Option<usize> = None::<usize>;
65    const MAX_LENGTH: Option<usize> = None::<usize>;
66    const DEFAULT: Option<&'static str> = None::<&'static str>;
67    const PATTERN: Option<&'static str> = Some(
68        "(?^:^(:?(?^i:[0-9a-z\\-_\\.]+:[0-9a-zA-Z\\-_]+))(:?[;, ](?^i:[0-9a-z\\-_\\.]+:[0-9a-zA-Z\\-_]+))*$)",
69    );
70    const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(?^:^(:?(?^i:[0-9a-z\\-_\\.]+:[0-9a-zA-Z\\-_]+))(:?[;, ](?^i:[0-9a-z\\-_\\.]+:[0-9a-zA-Z\\-_]+))*$)\" and no length constraints";
71    fn get_value(&self) -> &str {
72        &self.value
73    }
74    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
75        Self::validate(&value)?;
76        Ok(Self { value })
77    }
78}
79impl std::convert::TryFrom<String> for ConfigKeysStr {
80    type Error = crate::types::bounded_string::BoundedStringError;
81    fn try_from(value: String) -> Result<Self, Self::Error> {
82        crate::types::bounded_string::BoundedString::new(value)
83    }
84}
85impl ::serde::Serialize for ConfigKeysStr {
86    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
87    where
88        S: ::serde::Serializer,
89    {
90        crate::types::bounded_string::serialize_bounded_string(self, serializer)
91    }
92}
93impl<'de> ::serde::Deserialize<'de> for ConfigKeysStr {
94    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
95    where
96        D: ::serde::Deserializer<'de>,
97    {
98        crate::types::bounded_string::deserialize_bounded_string(deserializer)
99    }
100}