Skip to main content

authentik_client/models/
event_matcher_policy.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2026.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// EventMatcherPolicy : Event Matcher Policy Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct EventMatcherPolicy {
17    #[serde(rename = "pk")]
18    pub pk: uuid::Uuid,
19    #[serde(rename = "name")]
20    pub name: String,
21    /// When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.
22    #[serde(rename = "execution_logging", skip_serializing_if = "Option::is_none")]
23    pub execution_logging: Option<bool>,
24    /// Get object component so that we know how to edit the object
25    #[serde(rename = "component")]
26    pub component: String,
27    /// Return object's verbose_name
28    #[serde(rename = "verbose_name")]
29    pub verbose_name: String,
30    /// Return object's plural verbose_name
31    #[serde(rename = "verbose_name_plural")]
32    pub verbose_name_plural: String,
33    /// Return internal model name
34    #[serde(rename = "meta_model_name")]
35    pub meta_model_name: String,
36    /// Return objects policy is bound to
37    #[serde(rename = "bound_to")]
38    pub bound_to: i32,
39    /// Match created events with this action type. When left empty, all action types will be matched.
40    #[serde(
41        rename = "action",
42        default,
43        with = "::serde_with::rust::double_option",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub action: Option<Option<models::EventActions>>,
47    /// Matches Event's Client IP (strict matching, for network matching use an Expression Policy)
48    #[serde(
49        rename = "client_ip",
50        default,
51        with = "::serde_with::rust::double_option",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub client_ip: Option<Option<String>>,
55    /// Match events created by selected application. When left empty, all applications are matched.
56    #[serde(
57        rename = "app",
58        default,
59        with = "::serde_with::rust::double_option",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub app: Option<Option<models::AppEnum>>,
63    /// Match events created by selected model. When left empty, all models are matched. When an app is selected, all the application's models are matched.
64    #[serde(
65        rename = "model",
66        default,
67        with = "::serde_with::rust::double_option",
68        skip_serializing_if = "Option::is_none"
69    )]
70    pub model: Option<Option<models::ModelEnum>>,
71}
72
73impl EventMatcherPolicy {
74    /// Event Matcher Policy Serializer
75    pub fn new(
76        pk: uuid::Uuid,
77        name: String,
78        component: String,
79        verbose_name: String,
80        verbose_name_plural: String,
81        meta_model_name: String,
82        bound_to: i32,
83    ) -> EventMatcherPolicy {
84        EventMatcherPolicy {
85            pk,
86            name,
87            execution_logging: None,
88            component,
89            verbose_name,
90            verbose_name_plural,
91            meta_model_name,
92            bound_to,
93            action: None,
94            client_ip: None,
95            app: None,
96            model: None,
97        }
98    }
99}