Skip to main content

nautobot_openapi/models/
job_button.rs

1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// JobButton : 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 JobButton {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18    pub object_type: Option<String>,
19    /// Human friendly display value
20    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
21    pub display: Option<String>,
22    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
23    pub url: Option<String>,
24    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
25    pub natural_slug: Option<String>,
26    #[serde(rename = "content_types")]
27    pub content_types: Vec<String>,
28    #[serde(rename = "name")]
29    pub name: String,
30    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
31    pub enabled: Option<bool>,
32    /// Jinja2 template code for button text. Reference the object as <code>{{ obj }}</code> such as <code>{{ obj.platform.name }}</code>. Buttons which render as empty text will not be displayed.
33    #[serde(rename = "text")]
34    pub text: String,
35    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
36    pub weight: Option<i32>,
37    /// Buttons with the same group will appear as a dropdown menu. Group dropdown buttons will inherit the button class from the button with the lowest weight in the group.
38    #[serde(rename = "group_name", skip_serializing_if = "Option::is_none")]
39    pub group_name: Option<String>,
40    #[serde(rename = "button_class", skip_serializing_if = "Option::is_none")]
41    pub button_class: Option<crate::models::ButtonClassEnum>,
42    /// Enable confirmation pop-up box. <span class='text-danger'>WARNING: unselecting this option will allow the Job to run (and commit changes) with a single click!</span>
43    #[serde(rename = "confirmation", skip_serializing_if = "Option::is_none")]
44    pub confirmation: Option<bool>,
45    #[serde(rename = "job")]
46    pub job: Box<crate::models::BulkWritableJobButtonRequestJob>,
47    #[serde(
48        rename = "created",
49        default,
50        with = "::serde_with::rust::double_option",
51        skip_serializing_if = "Option::is_none"
52    )]
53    pub created: Option<Option<String>>,
54    #[serde(
55        rename = "last_updated",
56        default,
57        with = "::serde_with::rust::double_option",
58        skip_serializing_if = "Option::is_none"
59    )]
60    pub last_updated: Option<Option<String>>,
61    #[serde(rename = "notes_url", skip_serializing_if = "Option::is_none")]
62    pub notes_url: Option<String>,
63}
64
65impl JobButton {
66    /// 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>)
67    pub fn new(
68        content_types: Vec<String>,
69        name: String,
70        text: String,
71        job: crate::models::BulkWritableJobButtonRequestJob,
72    ) -> JobButton {
73        JobButton {
74            id: None,
75            object_type: None,
76            display: None,
77            url: None,
78            natural_slug: None,
79            content_types,
80            name,
81            enabled: None,
82            text,
83            weight: None,
84            group_name: None,
85            button_class: None,
86            confirmation: None,
87            job: Box::new(job),
88            created: None,
89            last_updated: None,
90            notes_url: None,
91        }
92    }
93}