authentik_client/models/
plex_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.12.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// PlexSource : Plex Source Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PlexSource {
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    /// When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
28    #[serde(rename = "promoted", skip_serializing_if = "Option::is_none")]
29    pub promoted: Option<bool>,
30    /// Flow to use when authenticating existing users.
31    #[serde(
32        rename = "authentication_flow",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub authentication_flow: Option<Option<uuid::Uuid>>,
38    /// Flow to use when enrolling new users.
39    #[serde(
40        rename = "enrollment_flow",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub enrollment_flow: Option<Option<uuid::Uuid>>,
46    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
47    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
48    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
49    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
50    /// Get object component so that we know how to edit the object
51    #[serde(rename = "component")]
52    pub component: String,
53    /// Return object's verbose_name
54    #[serde(rename = "verbose_name")]
55    pub verbose_name: String,
56    /// Return object's plural verbose_name
57    #[serde(rename = "verbose_name_plural")]
58    pub verbose_name_plural: String,
59    /// Return internal model name
60    #[serde(rename = "meta_model_name")]
61    pub meta_model_name: String,
62    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
63    pub policy_engine_mode: Option<models::PolicyEngineMode>,
64    /// How the source determines if an existing user should be authenticated or a new user enrolled.
65    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
66    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
67    /// 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.
68    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
69    pub managed: Option<String>,
70    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
71    pub user_path_template: Option<String>,
72    #[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
73    pub icon: Option<String>,
74    #[serde(rename = "icon_url")]
75    pub icon_url: String,
76    /// How the source determines if an existing group should be used or a new group created.
77    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
78    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
79    /// Client identifier used to talk to Plex.
80    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
81    pub client_id: Option<String>,
82    /// Which servers a user has to be a member of to be granted access. Empty list allows every server.
83    #[serde(rename = "allowed_servers", skip_serializing_if = "Option::is_none")]
84    pub allowed_servers: Option<Vec<String>>,
85    /// Allow friends to authenticate, even if you don't share a server.
86    #[serde(rename = "allow_friends", skip_serializing_if = "Option::is_none")]
87    pub allow_friends: Option<bool>,
88    /// Plex token used to check friends
89    #[serde(rename = "plex_token")]
90    pub plex_token: String,
91}
92
93impl PlexSource {
94    /// Plex Source Serializer
95    pub fn new(
96        pk: uuid::Uuid,
97        name: String,
98        slug: String,
99        component: String,
100        verbose_name: String,
101        verbose_name_plural: String,
102        meta_model_name: String,
103        managed: Option<String>,
104        icon_url: String,
105        plex_token: String,
106    ) -> PlexSource {
107        PlexSource {
108            pk,
109            name,
110            slug,
111            enabled: None,
112            promoted: None,
113            authentication_flow: None,
114            enrollment_flow: None,
115            user_property_mappings: None,
116            group_property_mappings: None,
117            component,
118            verbose_name,
119            verbose_name_plural,
120            meta_model_name,
121            policy_engine_mode: None,
122            user_matching_mode: None,
123            managed,
124            user_path_template: None,
125            icon: None,
126            icon_url,
127            group_matching_mode: None,
128            client_id: None,
129            allowed_servers: None,
130            allow_friends: None,
131            plex_token,
132        }
133    }
134}