misp_client_rs/models/
search_events_request.rs

1//!
2//! MISP Automation API
3//!
4//!  ### Getting Started  MISP API allows you to query, create, modify data models, such as [Events](https://www.circl.lu/doc/misp/GLOSSARY.html#misp-event), [Objects](https://www.circl.lu/doc/misp/misp-objects/), [Attributes](https://www.circl.lu/doc/misp/GLOSSARY.html#misp-attribute). This is extremly useful for interconnecting MISP with external tools and feeding other systems with threat intel data.  It also lets you perform administrative tasks such as creating users, organisations, altering MISP settings, and much more.  To get an API key there are several options: * **[UI]** Go to [My Profile -> Auth Keys](/auth_keys/index) section and click on `+ Add authentication key`  * **[UI]** As an admin go to the the [Administration -> List Users -> View](/admin/users/view/[id]) page of the user you want to create an auth key for and on the `Auth keys` section click on `+ Add authentication key`  * **[CLI]** Use the following command: `./app/Console/cake user change_authkey [e-mail/user_id]`  * **API** Provided you already have an admin level API key, you can create an API key for another user using the `[POST]/auth_keys/add/{{user_id}}` endpoint.  > **NOTE:** The authentication key will only be displayed once, so take note of it or store it properly in your application secrets.  #### Accept and Content-Type headers  When performing your request, depending on the type of request, you might need to explicitly specify in what content  type you want to get your results. This is done by setting one of the below `Accept` headers:      Accept: application/json     Accept: application/xml  When submitting data in a `POST`, `PUT` or `DELETE` operation you also need to specify in what content-type you encoded the payload.  This is done by setting one of the below `Content-Type` headers:      Content-Type: application/json     Content-Type: application/xml  Example: ``` curl  --header \"Authorization: YOUR_API_KEY\" \\       --header \"Accept: application/json\" \\       --header \"Content-Type: application/json\" https://<misp url>/  ```  > **NOTE**: By appending .json or .xml the content type can also be set without the need for a header.  #### Automation using PyMISP  [PyMISP](https://github.com/MISP/PyMISP) is a Python library to access MISP platforms via their REST [API](https://www.circl.lu/doc/misp/GLOSSARY.html#api). It allows you to fetch events, add or update events/attributes, add or update samples or search for attributes.  ### FAQ * [Dev FAQ](https://www.circl.lu/doc/misp/dev-faq/) * [GitHub project FAQ](https://github.com/MISP/MISP/wiki/Frequently-Asked-Questions) 
5//!
6//! The version of the OpenAPI document: 2.4
7//! 
8//! Generated by: https://openapi-generator.tech
9//! 
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SearchEventsRequest {
16    #[serde(rename = "page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub page: Option<Option<i32>>,
18    #[serde(rename = "limit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub limit: Option<Option<i32>>,
20    /// Field to be used to sort the result
21    #[serde(rename = "sort", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub sort: Option<Option<String>>,
23    #[serde(rename = "direction", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub direction: Option<Option<models::DirectionSearchField>>,
25    /// Returns a minimal version of the event, only events with `attributeCount` > 0 will be returned
26    #[serde(rename = "minimal", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub minimal: Option<Option<bool>>,
28    /// Filter events matching the given string with attributes values
29    #[serde(rename = "attribute", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub attribute: Option<Option<String>>,
31    #[serde(rename = "eventid", skip_serializing_if = "Option::is_none")]
32    pub eventid: Option<String>,
33    /// Event creation date is greater or equal
34    #[serde(rename = "datefrom", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub datefrom: Option<Option<String>>,
36    /// Event creation date is less or equal
37    #[serde(rename = "dateuntil", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub dateuntil: Option<Option<String>>,
39    /// Filter events by matching the creator organisation name
40    #[serde(rename = "org", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
41    pub org: Option<Option<String>>,
42    /// Filter events by matching the event info text
43    #[serde(rename = "eventinfo", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
44    pub eventinfo: Option<Option<String>>,
45    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
46    pub tag: Option<String>,
47    /// Filter events by matching *any* of the event tags of a given list of tag names
48    #[serde(rename = "tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub tags: Option<Option<Vec<String>>>,
50    #[serde(rename = "distribution", skip_serializing_if = "Option::is_none")]
51    pub distribution: Option<models::DistributionLevelId>,
52    #[serde(rename = "sharinggroup", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
53    pub sharinggroup: Option<Option<String>>,
54    #[serde(rename = "analysis", skip_serializing_if = "Option::is_none")]
55    pub analysis: Option<models::AnalysisLevelId>,
56    #[serde(rename = "threatlevel", skip_serializing_if = "Option::is_none")]
57    pub threatlevel: Option<models::ThreatLevelId>,
58    /// Filter events by matching the event creator user email
59    #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
60    pub email: Option<Option<String>>,
61    /// Filter events by checking if it has attributes with change proposals. Possible values: `0`, `1`
62    #[serde(rename = "hasproposal", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
63    pub hasproposal: Option<Option<String>>,
64    /// Event timestamp greater or equal
65    #[serde(rename = "timestamp", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
66    pub timestamp: Option<Option<String>>,
67    /// Event publish timestamp greater or equal
68    #[serde(rename = "publish_timestamp", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
69    pub publish_timestamp: Option<Option<String>>,
70    /// Filters on the date, anything newer than the given date in YYYY-MM-DD format is taken - non-negatable
71    #[serde(rename = "searchDatefrom", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
72    pub search_datefrom: Option<Option<String>>,
73    /// Filters on the date, anything older than the given date in YYYY-MM-DD format is taken - non-negatable
74    #[serde(rename = "searchDateuntil", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
75    pub search_dateuntil: Option<Option<String>>,
76}
77
78impl SearchEventsRequest {
79    pub fn new() -> SearchEventsRequest {
80        SearchEventsRequest {
81            page: None,
82            limit: None,
83            sort: None,
84            direction: None,
85            minimal: None,
86            attribute: None,
87            eventid: None,
88            datefrom: None,
89            dateuntil: None,
90            org: None,
91            eventinfo: None,
92            tag: None,
93            tags: None,
94            distribution: None,
95            sharinggroup: None,
96            analysis: None,
97            threatlevel: None,
98            email: None,
99            hasproposal: None,
100            timestamp: None,
101            publish_timestamp: None,
102            search_datefrom: None,
103            search_dateuntil: None,
104        }
105    }
106}
107