Skip to main content

nautobot_openapi/models/
bulk_writable_object_permission_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/// BulkWritableObjectPermissionRequest : 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 BulkWritableObjectPermissionRequest {
15    #[serde(rename = "id")]
16    pub id: uuid::Uuid,
17    #[serde(rename = "object_types")]
18    pub object_types: Vec<String>,
19    #[serde(rename = "name")]
20    pub name: String,
21    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
22    pub description: Option<String>,
23    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
24    pub enabled: Option<bool>,
25    /// The list of actions granted by this permission
26    #[serde(rename = "actions", deserialize_with = "Option::deserialize")]
27    pub actions: Option<serde_json::Value>,
28    /// Queryset filter matching the applicable objects of the selected type(s)
29    #[serde(
30        rename = "constraints",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub constraints: Option<Option<serde_json::Value>>,
36    #[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
37    pub groups: Option<Vec<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>>,
38    #[serde(rename = "users", skip_serializing_if = "Option::is_none")]
39    pub users: Option<Vec<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>>,
40}
41
42impl BulkWritableObjectPermissionRequest {
43    /// 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>)
44    pub fn new(
45        id: uuid::Uuid,
46        object_types: Vec<String>,
47        name: String,
48        actions: Option<serde_json::Value>,
49    ) -> BulkWritableObjectPermissionRequest {
50        BulkWritableObjectPermissionRequest {
51            id,
52            object_types,
53            name,
54            description: None,
55            enabled: None,
56            actions,
57            constraints: None,
58            groups: None,
59            users: None,
60        }
61    }
62}