Skip to main content

authentik_client/models/
plex_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.10.4
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    /// 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    #[serde(rename = "icon")]
70    pub icon: String,
71    /// How the source determines if an existing group should be used or a new group created.
72    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
73    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
74    /// Client identifier used to talk to Plex.
75    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
76    pub client_id: Option<String>,
77    /// Which servers a user has to be a member of to be granted access. Empty list allows every server.
78    #[serde(rename = "allowed_servers", skip_serializing_if = "Option::is_none")]
79    pub allowed_servers: Option<Vec<String>>,
80    /// Allow friends to authenticate, even if you don't share a server.
81    #[serde(rename = "allow_friends", skip_serializing_if = "Option::is_none")]
82    pub allow_friends: Option<bool>,
83    /// Plex token used to check friends
84    #[serde(rename = "plex_token")]
85    pub plex_token: String,
86}
87
88impl PlexSource {
89    /// Plex Source Serializer
90    pub fn new(
91        pk: uuid::Uuid,
92        name: String,
93        slug: String,
94        component: String,
95        verbose_name: String,
96        verbose_name_plural: String,
97        meta_model_name: String,
98        managed: Option<String>,
99        icon: String,
100        plex_token: String,
101    ) -> PlexSource {
102        PlexSource {
103            pk,
104            name,
105            slug,
106            enabled: None,
107            authentication_flow: None,
108            enrollment_flow: None,
109            user_property_mappings: None,
110            group_property_mappings: None,
111            component,
112            verbose_name,
113            verbose_name_plural,
114            meta_model_name,
115            policy_engine_mode: None,
116            user_matching_mode: None,
117            managed,
118            user_path_template: None,
119            icon,
120            group_matching_mode: None,
121            client_id: None,
122            allowed_servers: None,
123            allow_friends: None,
124            plex_token,
125        }
126    }
127}