Skip to main content

nautobot_openapi/models/
bulk_writable_custom_link_request.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/// BulkWritableCustomLinkRequest : 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 BulkWritableCustomLinkRequest {
15    #[serde(rename = "id")]
16    pub id: uuid::Uuid,
17    #[serde(rename = "content_type")]
18    pub content_type: String,
19    #[serde(rename = "name")]
20    pub name: String,
21    /// Jinja2 template code for link text. Reference the object as <code>{{ obj }}</code> such as <code>{{ obj.platform.name }}</code>. Links which render as empty text will not be displayed.
22    #[serde(rename = "text")]
23    pub text: String,
24    /// Jinja2 template code for link URL. Reference the object as <code>{{ obj }}</code> such as <code>{{ obj.platform.name }}</code>.
25    #[serde(rename = "target_url")]
26    pub target_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    #[serde(rename = "button_class", skip_serializing_if = "Option::is_none")]
33    pub button_class: Option<crate::models::ButtonClassEnum>,
34    /// Force link to open in a new window
35    #[serde(rename = "new_window")]
36    pub new_window: bool,
37}
38
39impl BulkWritableCustomLinkRequest {
40    /// 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>)
41    pub fn new(
42        id: uuid::Uuid,
43        content_type: String,
44        name: String,
45        text: String,
46        target_url: String,
47        new_window: bool,
48    ) -> BulkWritableCustomLinkRequest {
49        BulkWritableCustomLinkRequest {
50            id,
51            content_type,
52            name,
53            text,
54            target_url,
55            weight: None,
56            group_name: None,
57            button_class: None,
58            new_window,
59        }
60    }
61}