Skip to main content

bitwarden_api_api/models/
event_type.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Visitor};
12
13use crate::models;
14///
15#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16pub enum EventType {
17    User_LoggedIn,
18    User_ChangedPassword,
19    User_Updated2fa,
20    User_Disabled2fa,
21    User_Recovered2fa,
22    User_FailedLogIn,
23    User_FailedLogIn2fa,
24    User_ClientExportedVault,
25    User_UpdatedTempPassword,
26    User_MigratedKeyToKeyConnector,
27    User_RequestedDeviceApproval,
28    User_TdeOffboardingPasswordSet,
29    Cipher_Created,
30    Cipher_Updated,
31    Cipher_Deleted,
32    Cipher_AttachmentCreated,
33    Cipher_AttachmentDeleted,
34    Cipher_Shared,
35    Cipher_UpdatedCollections,
36    Cipher_ClientViewed,
37    Cipher_ClientToggledPasswordVisible,
38    Cipher_ClientToggledHiddenFieldVisible,
39    Cipher_ClientToggledCardCodeVisible,
40    Cipher_ClientCopiedPassword,
41    Cipher_ClientCopiedHiddenField,
42    Cipher_ClientCopiedCardCode,
43    Cipher_ClientAutofilled,
44    Cipher_SoftDeleted,
45    Cipher_Restored,
46    Cipher_ClientToggledCardNumberVisible,
47    Cipher_ClientToggledTOTPSeedVisible,
48    Cipher_ClientCopiedBankAccountNumber,
49    Cipher_ClientCopiedBankAccountPin,
50    Cipher_ClientToggledBankAccountNumberVisible,
51    Cipher_ClientToggledBankAccountPinVisible,
52    Cipher_ClientCopiedLicenseNumber,
53    Cipher_ClientToggledLicenseNumberVisible,
54    Cipher_ClientCopiedPassportNumber,
55    Cipher_ClientToggledPassportNumberVisible,
56    Collection_Created,
57    Collection_Updated,
58    Collection_Deleted,
59    Group_Created,
60    Group_Updated,
61    Group_Deleted,
62    OrganizationUser_Invited,
63    OrganizationUser_Confirmed,
64    OrganizationUser_Updated,
65    OrganizationUser_Removed,
66    OrganizationUser_UpdatedGroups,
67    OrganizationUser_UnlinkedSso,
68    OrganizationUser_ResetPassword_Enroll,
69    OrganizationUser_ResetPassword_Withdraw,
70    OrganizationUser_AdminResetPassword,
71    OrganizationUser_ResetSsoLink,
72    OrganizationUser_FirstSsoLogin,
73    OrganizationUser_Revoked,
74    OrganizationUser_Restored,
75    OrganizationUser_ApprovedAuthRequest,
76    OrganizationUser_RejectedAuthRequest,
77    OrganizationUser_Deleted,
78    OrganizationUser_Left,
79    OrganizationUser_AutomaticallyConfirmed,
80    OrganizationUser_SelfRevoked,
81    OrganizationUser_AdminResetTwoFactor,
82    OrganizationUser_Revoked_TwoFactorNonCompliance,
83    OrganizationUser_Revoked_SingleOrganizationNonCompliance,
84    Organization_Updated,
85    Organization_PurgedVault,
86    Organization_ClientExportedVault,
87    Organization_VaultAccessed,
88    Organization_EnabledSso,
89    Organization_DisabledSso,
90    Organization_EnabledKeyConnector,
91    Organization_DisabledKeyConnector,
92    Organization_SponsorshipsSynced,
93    Organization_CollectionManagement_Updated,
94    Organization_CollectionManagement_LimitCollectionCreationEnabled,
95    Organization_CollectionManagement_LimitCollectionCreationDisabled,
96    Organization_CollectionManagement_LimitCollectionDeletionEnabled,
97    Organization_CollectionManagement_LimitCollectionDeletionDisabled,
98    Organization_CollectionManagement_LimitItemDeletionEnabled,
99    Organization_CollectionManagement_LimitItemDeletionDisabled,
100    Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled,
101    Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled,
102    Organization_ItemOrganization_Accepted,
103    Organization_ItemOrganization_Declined,
104    Organization_AutoConfirmEnabled_Admin,
105    Organization_AutoConfirmDisabled_Admin,
106    Organization_AutoConfirmEnabled_Portal,
107    Organization_AutoConfirmDisabled_Portal,
108    Policy_Updated,
109    ProviderUser_Invited,
110    ProviderUser_Confirmed,
111    ProviderUser_Updated,
112    ProviderUser_Removed,
113    ProviderOrganization_Created,
114    ProviderOrganization_Added,
115    ProviderOrganization_Removed,
116    ProviderOrganization_VaultAccessed,
117    OrganizationDomain_Added,
118    OrganizationDomain_Removed,
119    OrganizationDomain_Verified,
120    OrganizationDomain_NotVerified,
121    Secret_Retrieved,
122    Secret_Created,
123    Secret_Edited,
124    Secret_Deleted,
125    Secret_Permanently_Deleted,
126    Secret_Restored,
127    Project_Retrieved,
128    Project_Created,
129    Project_Edited,
130    Project_Deleted,
131    ServiceAccount_UserAdded,
132    ServiceAccount_UserRemoved,
133    ServiceAccount_GroupAdded,
134    ServiceAccount_GroupRemoved,
135    ServiceAccount_Created,
136    ServiceAccount_Deleted,
137    PhishingBlocker_SiteAccessed,
138    PhishingBlocker_SiteExited,
139    PhishingBlocker_Bypassed,
140
141    /// Unknown value returned from the server. This is used to handle forward compatibility.
142    __Unknown(i64),
143}
144
145impl EventType {
146    pub fn as_i64(&self) -> i64 {
147        match self {
148            Self::User_LoggedIn => 1000,
149            Self::User_ChangedPassword => 1001,
150            Self::User_Updated2fa => 1002,
151            Self::User_Disabled2fa => 1003,
152            Self::User_Recovered2fa => 1004,
153            Self::User_FailedLogIn => 1005,
154            Self::User_FailedLogIn2fa => 1006,
155            Self::User_ClientExportedVault => 1007,
156            Self::User_UpdatedTempPassword => 1008,
157            Self::User_MigratedKeyToKeyConnector => 1009,
158            Self::User_RequestedDeviceApproval => 1010,
159            Self::User_TdeOffboardingPasswordSet => 1011,
160            Self::Cipher_Created => 1100,
161            Self::Cipher_Updated => 1101,
162            Self::Cipher_Deleted => 1102,
163            Self::Cipher_AttachmentCreated => 1103,
164            Self::Cipher_AttachmentDeleted => 1104,
165            Self::Cipher_Shared => 1105,
166            Self::Cipher_UpdatedCollections => 1106,
167            Self::Cipher_ClientViewed => 1107,
168            Self::Cipher_ClientToggledPasswordVisible => 1108,
169            Self::Cipher_ClientToggledHiddenFieldVisible => 1109,
170            Self::Cipher_ClientToggledCardCodeVisible => 1110,
171            Self::Cipher_ClientCopiedPassword => 1111,
172            Self::Cipher_ClientCopiedHiddenField => 1112,
173            Self::Cipher_ClientCopiedCardCode => 1113,
174            Self::Cipher_ClientAutofilled => 1114,
175            Self::Cipher_SoftDeleted => 1115,
176            Self::Cipher_Restored => 1116,
177            Self::Cipher_ClientToggledCardNumberVisible => 1117,
178            Self::Cipher_ClientToggledTOTPSeedVisible => 1118,
179            Self::Cipher_ClientCopiedBankAccountNumber => 1119,
180            Self::Cipher_ClientCopiedBankAccountPin => 1120,
181            Self::Cipher_ClientToggledBankAccountNumberVisible => 1121,
182            Self::Cipher_ClientToggledBankAccountPinVisible => 1122,
183            Self::Cipher_ClientCopiedLicenseNumber => 1123,
184            Self::Cipher_ClientToggledLicenseNumberVisible => 1124,
185            Self::Cipher_ClientCopiedPassportNumber => 1125,
186            Self::Cipher_ClientToggledPassportNumberVisible => 1126,
187            Self::Collection_Created => 1300,
188            Self::Collection_Updated => 1301,
189            Self::Collection_Deleted => 1302,
190            Self::Group_Created => 1400,
191            Self::Group_Updated => 1401,
192            Self::Group_Deleted => 1402,
193            Self::OrganizationUser_Invited => 1500,
194            Self::OrganizationUser_Confirmed => 1501,
195            Self::OrganizationUser_Updated => 1502,
196            Self::OrganizationUser_Removed => 1503,
197            Self::OrganizationUser_UpdatedGroups => 1504,
198            Self::OrganizationUser_UnlinkedSso => 1505,
199            Self::OrganizationUser_ResetPassword_Enroll => 1506,
200            Self::OrganizationUser_ResetPassword_Withdraw => 1507,
201            Self::OrganizationUser_AdminResetPassword => 1508,
202            Self::OrganizationUser_ResetSsoLink => 1509,
203            Self::OrganizationUser_FirstSsoLogin => 1510,
204            Self::OrganizationUser_Revoked => 1511,
205            Self::OrganizationUser_Restored => 1512,
206            Self::OrganizationUser_ApprovedAuthRequest => 1513,
207            Self::OrganizationUser_RejectedAuthRequest => 1514,
208            Self::OrganizationUser_Deleted => 1515,
209            Self::OrganizationUser_Left => 1516,
210            Self::OrganizationUser_AutomaticallyConfirmed => 1517,
211            Self::OrganizationUser_SelfRevoked => 1518,
212            Self::OrganizationUser_AdminResetTwoFactor => 1519,
213            Self::OrganizationUser_Revoked_TwoFactorNonCompliance => 1520,
214            Self::OrganizationUser_Revoked_SingleOrganizationNonCompliance => 1521,
215            Self::Organization_Updated => 1600,
216            Self::Organization_PurgedVault => 1601,
217            Self::Organization_ClientExportedVault => 1602,
218            Self::Organization_VaultAccessed => 1603,
219            Self::Organization_EnabledSso => 1604,
220            Self::Organization_DisabledSso => 1605,
221            Self::Organization_EnabledKeyConnector => 1606,
222            Self::Organization_DisabledKeyConnector => 1607,
223            Self::Organization_SponsorshipsSynced => 1608,
224            Self::Organization_CollectionManagement_Updated => 1609,
225            Self::Organization_CollectionManagement_LimitCollectionCreationEnabled => 1610,
226            Self::Organization_CollectionManagement_LimitCollectionCreationDisabled => 1611,
227            Self::Organization_CollectionManagement_LimitCollectionDeletionEnabled => 1612,
228            Self::Organization_CollectionManagement_LimitCollectionDeletionDisabled => 1613,
229            Self::Organization_CollectionManagement_LimitItemDeletionEnabled => 1614,
230            Self::Organization_CollectionManagement_LimitItemDeletionDisabled => 1615,
231            Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled => 1616,
232            Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled => 1617,
233            Self::Organization_ItemOrganization_Accepted => 1618,
234            Self::Organization_ItemOrganization_Declined => 1619,
235            Self::Organization_AutoConfirmEnabled_Admin => 1620,
236            Self::Organization_AutoConfirmDisabled_Admin => 1621,
237            Self::Organization_AutoConfirmEnabled_Portal => 1622,
238            Self::Organization_AutoConfirmDisabled_Portal => 1623,
239            Self::Policy_Updated => 1700,
240            Self::ProviderUser_Invited => 1800,
241            Self::ProviderUser_Confirmed => 1801,
242            Self::ProviderUser_Updated => 1802,
243            Self::ProviderUser_Removed => 1803,
244            Self::ProviderOrganization_Created => 1900,
245            Self::ProviderOrganization_Added => 1901,
246            Self::ProviderOrganization_Removed => 1902,
247            Self::ProviderOrganization_VaultAccessed => 1903,
248            Self::OrganizationDomain_Added => 2000,
249            Self::OrganizationDomain_Removed => 2001,
250            Self::OrganizationDomain_Verified => 2002,
251            Self::OrganizationDomain_NotVerified => 2003,
252            Self::Secret_Retrieved => 2100,
253            Self::Secret_Created => 2101,
254            Self::Secret_Edited => 2102,
255            Self::Secret_Deleted => 2103,
256            Self::Secret_Permanently_Deleted => 2104,
257            Self::Secret_Restored => 2105,
258            Self::Project_Retrieved => 2200,
259            Self::Project_Created => 2201,
260            Self::Project_Edited => 2202,
261            Self::Project_Deleted => 2203,
262            Self::ServiceAccount_UserAdded => 2300,
263            Self::ServiceAccount_UserRemoved => 2301,
264            Self::ServiceAccount_GroupAdded => 2302,
265            Self::ServiceAccount_GroupRemoved => 2303,
266            Self::ServiceAccount_Created => 2304,
267            Self::ServiceAccount_Deleted => 2305,
268            Self::PhishingBlocker_SiteAccessed => 2400,
269            Self::PhishingBlocker_SiteExited => 2401,
270            Self::PhishingBlocker_Bypassed => 2402,
271            Self::__Unknown(v) => *v,
272        }
273    }
274
275    pub fn from_i64(value: i64) -> Self {
276        match value {
277            1000 => Self::User_LoggedIn,
278            1001 => Self::User_ChangedPassword,
279            1002 => Self::User_Updated2fa,
280            1003 => Self::User_Disabled2fa,
281            1004 => Self::User_Recovered2fa,
282            1005 => Self::User_FailedLogIn,
283            1006 => Self::User_FailedLogIn2fa,
284            1007 => Self::User_ClientExportedVault,
285            1008 => Self::User_UpdatedTempPassword,
286            1009 => Self::User_MigratedKeyToKeyConnector,
287            1010 => Self::User_RequestedDeviceApproval,
288            1011 => Self::User_TdeOffboardingPasswordSet,
289            1100 => Self::Cipher_Created,
290            1101 => Self::Cipher_Updated,
291            1102 => Self::Cipher_Deleted,
292            1103 => Self::Cipher_AttachmentCreated,
293            1104 => Self::Cipher_AttachmentDeleted,
294            1105 => Self::Cipher_Shared,
295            1106 => Self::Cipher_UpdatedCollections,
296            1107 => Self::Cipher_ClientViewed,
297            1108 => Self::Cipher_ClientToggledPasswordVisible,
298            1109 => Self::Cipher_ClientToggledHiddenFieldVisible,
299            1110 => Self::Cipher_ClientToggledCardCodeVisible,
300            1111 => Self::Cipher_ClientCopiedPassword,
301            1112 => Self::Cipher_ClientCopiedHiddenField,
302            1113 => Self::Cipher_ClientCopiedCardCode,
303            1114 => Self::Cipher_ClientAutofilled,
304            1115 => Self::Cipher_SoftDeleted,
305            1116 => Self::Cipher_Restored,
306            1117 => Self::Cipher_ClientToggledCardNumberVisible,
307            1118 => Self::Cipher_ClientToggledTOTPSeedVisible,
308            1119 => Self::Cipher_ClientCopiedBankAccountNumber,
309            1120 => Self::Cipher_ClientCopiedBankAccountPin,
310            1121 => Self::Cipher_ClientToggledBankAccountNumberVisible,
311            1122 => Self::Cipher_ClientToggledBankAccountPinVisible,
312            1123 => Self::Cipher_ClientCopiedLicenseNumber,
313            1124 => Self::Cipher_ClientToggledLicenseNumberVisible,
314            1125 => Self::Cipher_ClientCopiedPassportNumber,
315            1126 => Self::Cipher_ClientToggledPassportNumberVisible,
316            1300 => Self::Collection_Created,
317            1301 => Self::Collection_Updated,
318            1302 => Self::Collection_Deleted,
319            1400 => Self::Group_Created,
320            1401 => Self::Group_Updated,
321            1402 => Self::Group_Deleted,
322            1500 => Self::OrganizationUser_Invited,
323            1501 => Self::OrganizationUser_Confirmed,
324            1502 => Self::OrganizationUser_Updated,
325            1503 => Self::OrganizationUser_Removed,
326            1504 => Self::OrganizationUser_UpdatedGroups,
327            1505 => Self::OrganizationUser_UnlinkedSso,
328            1506 => Self::OrganizationUser_ResetPassword_Enroll,
329            1507 => Self::OrganizationUser_ResetPassword_Withdraw,
330            1508 => Self::OrganizationUser_AdminResetPassword,
331            1509 => Self::OrganizationUser_ResetSsoLink,
332            1510 => Self::OrganizationUser_FirstSsoLogin,
333            1511 => Self::OrganizationUser_Revoked,
334            1512 => Self::OrganizationUser_Restored,
335            1513 => Self::OrganizationUser_ApprovedAuthRequest,
336            1514 => Self::OrganizationUser_RejectedAuthRequest,
337            1515 => Self::OrganizationUser_Deleted,
338            1516 => Self::OrganizationUser_Left,
339            1517 => Self::OrganizationUser_AutomaticallyConfirmed,
340            1518 => Self::OrganizationUser_SelfRevoked,
341            1519 => Self::OrganizationUser_AdminResetTwoFactor,
342            1520 => Self::OrganizationUser_Revoked_TwoFactorNonCompliance,
343            1521 => Self::OrganizationUser_Revoked_SingleOrganizationNonCompliance,
344            1600 => Self::Organization_Updated,
345            1601 => Self::Organization_PurgedVault,
346            1602 => Self::Organization_ClientExportedVault,
347            1603 => Self::Organization_VaultAccessed,
348            1604 => Self::Organization_EnabledSso,
349            1605 => Self::Organization_DisabledSso,
350            1606 => Self::Organization_EnabledKeyConnector,
351            1607 => Self::Organization_DisabledKeyConnector,
352            1608 => Self::Organization_SponsorshipsSynced,
353            1609 => Self::Organization_CollectionManagement_Updated,
354            1610 => Self::Organization_CollectionManagement_LimitCollectionCreationEnabled,
355            1611 => Self::Organization_CollectionManagement_LimitCollectionCreationDisabled,
356            1612 => Self::Organization_CollectionManagement_LimitCollectionDeletionEnabled,
357            1613 => Self::Organization_CollectionManagement_LimitCollectionDeletionDisabled,
358            1614 => Self::Organization_CollectionManagement_LimitItemDeletionEnabled,
359            1615 => Self::Organization_CollectionManagement_LimitItemDeletionDisabled,
360            1616 => {
361                Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled
362            }
363            1617 => {
364                Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled
365            }
366            1618 => Self::Organization_ItemOrganization_Accepted,
367            1619 => Self::Organization_ItemOrganization_Declined,
368            1620 => Self::Organization_AutoConfirmEnabled_Admin,
369            1621 => Self::Organization_AutoConfirmDisabled_Admin,
370            1622 => Self::Organization_AutoConfirmEnabled_Portal,
371            1623 => Self::Organization_AutoConfirmDisabled_Portal,
372            1700 => Self::Policy_Updated,
373            1800 => Self::ProviderUser_Invited,
374            1801 => Self::ProviderUser_Confirmed,
375            1802 => Self::ProviderUser_Updated,
376            1803 => Self::ProviderUser_Removed,
377            1900 => Self::ProviderOrganization_Created,
378            1901 => Self::ProviderOrganization_Added,
379            1902 => Self::ProviderOrganization_Removed,
380            1903 => Self::ProviderOrganization_VaultAccessed,
381            2000 => Self::OrganizationDomain_Added,
382            2001 => Self::OrganizationDomain_Removed,
383            2002 => Self::OrganizationDomain_Verified,
384            2003 => Self::OrganizationDomain_NotVerified,
385            2100 => Self::Secret_Retrieved,
386            2101 => Self::Secret_Created,
387            2102 => Self::Secret_Edited,
388            2103 => Self::Secret_Deleted,
389            2104 => Self::Secret_Permanently_Deleted,
390            2105 => Self::Secret_Restored,
391            2200 => Self::Project_Retrieved,
392            2201 => Self::Project_Created,
393            2202 => Self::Project_Edited,
394            2203 => Self::Project_Deleted,
395            2300 => Self::ServiceAccount_UserAdded,
396            2301 => Self::ServiceAccount_UserRemoved,
397            2302 => Self::ServiceAccount_GroupAdded,
398            2303 => Self::ServiceAccount_GroupRemoved,
399            2304 => Self::ServiceAccount_Created,
400            2305 => Self::ServiceAccount_Deleted,
401            2400 => Self::PhishingBlocker_SiteAccessed,
402            2401 => Self::PhishingBlocker_SiteExited,
403            2402 => Self::PhishingBlocker_Bypassed,
404            v => Self::__Unknown(v),
405        }
406    }
407}
408
409impl serde::Serialize for EventType {
410    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
411        serializer.serialize_i64(self.as_i64())
412    }
413}
414
415impl<'de> serde::Deserialize<'de> for EventType {
416    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
417        struct EventTypeVisitor;
418
419        impl Visitor<'_> for EventTypeVisitor {
420            type Value = EventType;
421
422            fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
423                f.write_str("an integer")
424            }
425
426            fn visit_i64<E: serde::de::Error>(self, v: i64) -> Result<Self::Value, E> {
427                Ok(EventType::from_i64(v))
428            }
429
430            fn visit_u64<E: serde::de::Error>(self, v: u64) -> Result<Self::Value, E> {
431                Ok(EventType::from_i64(v as i64))
432            }
433        }
434
435        deserializer.deserialize_i64(EventTypeVisitor)
436    }
437}
438
439impl std::fmt::Display for EventType {
440    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
441        write!(f, "{}", self.as_i64())
442    }
443}
444impl Default for EventType {
445    fn default() -> EventType {
446        Self::User_LoggedIn
447    }
448}