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: 2026.2.0
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    #[serde(rename = "icon_themed_urls", deserialize_with = "Option::deserialize")]
77    pub icon_themed_urls: Option<models::ThemedUrls>,
78    /// How the source determines if an existing group should be used or a new group created.
79    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
80    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
81    /// Client identifier used to talk to Plex.
82    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
83    pub client_id: Option<String>,
84    /// Which servers a user has to be a member of to be granted access. Empty list allows every server.
85    #[serde(rename = "allowed_servers", skip_serializing_if = "Option::is_none")]
86    pub allowed_servers: Option<Vec<String>>,
87    /// Allow friends to authenticate, even if you don't share a server.
88    #[serde(rename = "allow_friends", skip_serializing_if = "Option::is_none")]
89    pub allow_friends: Option<bool>,
90    /// Plex token used to check friends
91    #[serde(rename = "plex_token")]
92    pub plex_token: String,
93}
94
95impl PlexSource {
96    /// Plex Source Serializer
97    pub fn new(
98        pk: uuid::Uuid,
99        name: String,
100        slug: String,
101        component: String,
102        verbose_name: String,
103        verbose_name_plural: String,
104        meta_model_name: String,
105        managed: Option<String>,
106        icon_url: String,
107        icon_themed_urls: Option<models::ThemedUrls>,
108        plex_token: String,
109    ) -> PlexSource {
110        PlexSource {
111            pk,
112            name,
113            slug,
114            enabled: None,
115            promoted: None,
116            authentication_flow: None,
117            enrollment_flow: None,
118            user_property_mappings: None,
119            group_property_mappings: None,
120            component,
121            verbose_name,
122            verbose_name_plural,
123            meta_model_name,
124            policy_engine_mode: None,
125            user_matching_mode: None,
126            managed,
127            user_path_template: None,
128            icon: None,
129            icon_url,
130            icon_themed_urls,
131            group_matching_mode: None,
132            client_id: None,
133            allowed_servers: None,
134            allow_friends: None,
135            plex_token,
136        }
137    }
138}