authentik_client/models/
source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.8.4
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Source : Source Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Source {
17    #[serde(rename = "pk")]
18    pub pk: uuid::Uuid,
19    /// Source's display Name.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// Internal source name, used in URLs.
23    #[serde(rename = "slug")]
24    pub slug: String,
25    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
26    pub enabled: Option<bool>,
27    /// Flow to use when authenticating existing users.
28    #[serde(
29        rename = "authentication_flow",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub authentication_flow: Option<Option<uuid::Uuid>>,
35    /// Flow to use when enrolling new users.
36    #[serde(
37        rename = "enrollment_flow",
38        default,
39        with = "::serde_with::rust::double_option",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub enrollment_flow: Option<Option<uuid::Uuid>>,
43    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
44    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
45    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
46    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
47    /// Get object component so that we know how to edit the object
48    #[serde(rename = "component")]
49    pub component: String,
50    /// Return object's verbose_name
51    #[serde(rename = "verbose_name")]
52    pub verbose_name: String,
53    /// Return object's plural verbose_name
54    #[serde(rename = "verbose_name_plural")]
55    pub verbose_name_plural: String,
56    /// Return internal model name
57    #[serde(rename = "meta_model_name")]
58    pub meta_model_name: String,
59    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
60    pub policy_engine_mode: Option<models::PolicyEngineMode>,
61    /// How the source determines if an existing user should be authenticated or a new user enrolled.
62    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
63    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
64    /// Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
65    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
66    pub managed: Option<String>,
67    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
68    pub user_path_template: Option<String>,
69    /// Get the URL to the Icon. If the name is /static or starts with http it is returned as-is
70    #[serde(rename = "icon", deserialize_with = "Option::deserialize")]
71    pub icon: Option<String>,
72}
73
74impl Source {
75    /// Source Serializer
76    pub fn new(
77        pk: uuid::Uuid,
78        name: String,
79        slug: String,
80        component: String,
81        verbose_name: String,
82        verbose_name_plural: String,
83        meta_model_name: String,
84        managed: Option<String>,
85        icon: Option<String>,
86    ) -> Source {
87        Source {
88            pk,
89            name,
90            slug,
91            enabled: None,
92            authentication_flow: None,
93            enrollment_flow: None,
94            user_property_mappings: None,
95            group_property_mappings: None,
96            component,
97            verbose_name,
98            verbose_name_plural,
99            meta_model_name,
100            policy_engine_mode: None,
101            user_matching_mode: None,
102            managed,
103            user_path_template: None,
104            icon,
105        }
106    }
107}