netbox_openapi/models/
custom_link_request.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// CustomLinkRequest : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct CustomLinkRequest {
15    #[serde(rename = "object_types")]
16    pub object_types: Vec<String>,
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
20    pub enabled: Option<bool>,
21    /// Jinja2 template code for link text
22    #[serde(rename = "link_text")]
23    pub link_text: String,
24    /// Jinja2 template code for link URL
25    #[serde(rename = "link_url")]
26    pub link_url: String,
27    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
28    pub weight: Option<i32>,
29    /// Links with the same group will appear as a dropdown menu
30    #[serde(rename = "group_name", skip_serializing_if = "Option::is_none")]
31    pub group_name: Option<String>,
32    /// The class of the first link in a group will be used for the dropdown button  * `default` - Default * `blue` - Blue * `indigo` - Indigo * `purple` - Purple * `pink` - Pink * `red` - Red * `orange` - Orange * `yellow` - Yellow * `green` - Green * `teal` - Teal * `cyan` - Cyan * `gray` - Gray * `black` - Black * `white` - White * `ghost-dark` - Link
33    #[serde(rename = "button_class", skip_serializing_if = "Option::is_none")]
34    pub button_class: Option<ButtonClass>,
35    /// Force link to open in a new window
36    #[serde(rename = "new_window", skip_serializing_if = "Option::is_none")]
37    pub new_window: Option<bool>,
38}
39
40impl CustomLinkRequest {
41    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
42    pub fn new(
43        object_types: Vec<String>,
44        name: String,
45        link_text: String,
46        link_url: String,
47    ) -> CustomLinkRequest {
48        CustomLinkRequest {
49            object_types,
50            name,
51            enabled: None,
52            link_text,
53            link_url,
54            weight: None,
55            group_name: None,
56            button_class: None,
57            new_window: None,
58        }
59    }
60}
61
62/// The class of the first link in a group will be used for the dropdown button  * `default` - Default * `blue` - Blue * `indigo` - Indigo * `purple` - Purple * `pink` - Pink * `red` - Red * `orange` - Orange * `yellow` - Yellow * `green` - Green * `teal` - Teal * `cyan` - Cyan * `gray` - Gray * `black` - Black * `white` - White * `ghost-dark` - Link
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum ButtonClass {
65    #[serde(rename = "default")]
66    Default,
67    #[serde(rename = "blue")]
68    Blue,
69    #[serde(rename = "indigo")]
70    Indigo,
71    #[serde(rename = "purple")]
72    Purple,
73    #[serde(rename = "pink")]
74    Pink,
75    #[serde(rename = "red")]
76    Red,
77    #[serde(rename = "orange")]
78    Orange,
79    #[serde(rename = "yellow")]
80    Yellow,
81    #[serde(rename = "green")]
82    Green,
83    #[serde(rename = "teal")]
84    Teal,
85    #[serde(rename = "cyan")]
86    Cyan,
87    #[serde(rename = "gray")]
88    Gray,
89    #[serde(rename = "black")]
90    Black,
91    #[serde(rename = "white")]
92    White,
93    #[serde(rename = "ghost-dark")]
94    GhostDark,
95}
96
97impl Default for ButtonClass {
98    fn default() -> ButtonClass {
99        Self::Default
100    }
101}