Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37460,12 +37460,17 @@ components:
type: integer
type: object
Event:
additionalProperties: {}
description: The metadata associated with a request.
properties:
id:
description: Event ID.
example: "6509751066204996294"
type: string
integration_id:
description: The integration ID of the event.
example: "custom-events"
type: string
name:
description: The event name.
type: string
Expand All @@ -37478,8 +37483,13 @@ components:
description: Event type.
example: "error_tracking_alert"
type: string
uid:
description: A unique identifier for the event. You can use this identifier to query or reference the event.
example: "AaBJ4QimAABPmEWRwc_8yAAA"
type: string
type: object
EventAttributes:
additionalProperties: {}
description: Object description of attributes from your event.
properties:
aggregation_key:
Expand Down Expand Up @@ -37729,16 +37739,27 @@ components:
- CUSTOM_EVENTS
EventPriority:
description: |-
The priority of the event's monitor. For example, `normal` or `low`.
The priority of the event alert. Legacy events use `normal` or `low`.
Alert events use `1` (highest priority) through `5` (lowest priority).
enum:
- normal
- low
- "1"
- "2"
- "3"
- "4"
- "5"
example: "normal"
nullable: true
type: string
x-enum-varnames:
- NORMAL
- LOW
- PRIORITY_ONE
- PRIORITY_TWO
- PRIORITY_THREE
- PRIORITY_FOUR
- PRIORITY_FIVE
EventResponse:
description: The object description of an event after being processed and stored by Datadog.
properties:
Expand Down Expand Up @@ -37774,13 +37795,15 @@ components:
type: object
EventStatusType:
description: |-
If an alert event is enabled, its status is one of the following:
`failure`, `error`, `warning`, `info`, `success`, `user_update`,
`recommendation`, or `snapshot`.
The event status. Legacy events can use `failure`, `error`, `warning`,
`info`, `success`, `user_update`, `recommendation`, or `snapshot`.
Alert events can use `error`, `warn`, or `ok`.
enum:
- failure
- error
- warn
- warning
- ok
- info
- success
- user_update
Expand All @@ -37791,7 +37814,9 @@ components:
x-enum-varnames:
- FAILURE
- ERROR
- WARN
- WARNING
- OK
- INFO
- SUCCESS
- USER_UPDATE
Expand Down Expand Up @@ -38046,7 +38071,7 @@ components:
type: string
limit:
default: 10
description: The maximum number of logs in the response.
description: The maximum number of events in the response.
example: 25
format: int32
maximum: 1000
Expand Down
35 changes: 35 additions & 0 deletions src/datadogV2/model/model_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pub struct Event {
/// Event ID.
#[serde(rename = "id")]
pub id: Option<String>,
/// The integration ID of the event.
#[serde(rename = "integration_id")]
pub integration_id: Option<String>,
/// The event name.
#[serde(rename = "name")]
pub name: Option<String>,
Expand All @@ -23,6 +26,9 @@ pub struct Event {
/// Event type.
#[serde(rename = "type")]
pub type_: Option<String>,
/// A unique identifier for the event. You can use this identifier to query or reference the event.
#[serde(rename = "uid")]
pub uid: Option<String>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
Expand All @@ -34,9 +40,11 @@ impl Event {
pub fn new() -> Event {
Event {
id: None,
integration_id: None,
name: None,
source_id: None,
type_: None,
uid: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
Expand All @@ -47,6 +55,11 @@ impl Event {
self
}

pub fn integration_id(mut self, value: String) -> Self {
self.integration_id = Some(value);
self
}

pub fn name(mut self, value: String) -> Self {
self.name = Some(value);
self
Expand All @@ -62,6 +75,11 @@ impl Event {
self
}

pub fn uid(mut self, value: String) -> Self {
self.uid = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -95,9 +113,11 @@ impl<'de> Deserialize<'de> for Event {
M: MapAccess<'a>,
{
let mut id: Option<String> = None;
let mut integration_id: Option<String> = None;
let mut name: Option<String> = None;
let mut source_id: Option<i64> = None;
let mut type_: Option<String> = None;
let mut uid: Option<String> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand All @@ -112,6 +132,13 @@ impl<'de> Deserialize<'de> for Event {
}
id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"integration_id" => {
if v.is_null() {
continue;
}
integration_id =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"name" => {
if v.is_null() {
continue;
Expand All @@ -130,6 +157,12 @@ impl<'de> Deserialize<'de> for Event {
}
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"uid" => {
if v.is_null() {
continue;
}
uid = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
Expand All @@ -140,9 +173,11 @@ impl<'de> Deserialize<'de> for Event {

let content = Event {
id,
integration_id,
name,
source_id,
type_,
uid,
additional_properties,
_unparsed,
};
Expand Down
9 changes: 5 additions & 4 deletions src/datadogV2/model/model_event_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ pub struct EventAttributes {
with = "::serde_with::rust::double_option"
)]
pub monitor_id: Option<Option<i64>>,
/// The priority of the event's monitor. For example, `normal` or `low`.
/// The priority of the event alert. Legacy events use `normal` or `low`.
/// Alert events use `1` (highest priority) through `5` (lowest priority).
#[serde(
rename = "priority",
default,
Expand All @@ -76,9 +77,9 @@ pub struct EventAttributes {
/// Identifier for the source of the event, such as a monitor alert, an externally-submitted event, or an integration.
#[serde(rename = "sourcecategory")]
pub sourcecategory: Option<String>,
/// If an alert event is enabled, its status is one of the following:
/// `failure`, `error`, `warning`, `info`, `success`, `user_update`,
/// `recommendation`, or `snapshot`.
/// The event status. Legacy events can use `failure`, `error`, `warning`,
/// `info`, `success`, `user_update`, `recommendation`, or `snapshot`.
/// Alert events can use `error`, `warn`, or `ok`.
#[serde(rename = "status")]
pub status: Option<crate::datadogV2::model::EventStatusType>,
/// A list of tags to apply to the event.
Expand Down
15 changes: 15 additions & 0 deletions src/datadogV2/model/model_event_priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
pub enum EventPriority {
NORMAL,
LOW,
PRIORITY_ONE,
PRIORITY_TWO,
PRIORITY_THREE,
PRIORITY_FOUR,
PRIORITY_FIVE,
UnparsedObject(crate::datadog::UnparsedObject),
}

Expand All @@ -17,6 +22,11 @@ impl ToString for EventPriority {
match self {
Self::NORMAL => String::from("normal"),
Self::LOW => String::from("low"),
Self::PRIORITY_ONE => String::from("1"),
Self::PRIORITY_TWO => String::from("2"),
Self::PRIORITY_THREE => String::from("3"),
Self::PRIORITY_FOUR => String::from("4"),
Self::PRIORITY_FIVE => String::from("5"),
Self::UnparsedObject(v) => v.value.to_string(),
}
}
Expand All @@ -43,6 +53,11 @@ impl<'de> Deserialize<'de> for EventPriority {
Ok(match s.as_str() {
"normal" => Self::NORMAL,
"low" => Self::LOW,
"1" => Self::PRIORITY_ONE,
"2" => Self::PRIORITY_TWO,
"3" => Self::PRIORITY_THREE,
"4" => Self::PRIORITY_FOUR,
"5" => Self::PRIORITY_FIVE,
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
value: serde_json::Value::String(s.into()),
}),
Expand Down
6 changes: 6 additions & 0 deletions src/datadogV2/model/model_event_status_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
pub enum EventStatusType {
FAILURE,
ERROR,
WARN,
WARNING,
OK,
INFO,
SUCCESS,
USER_UPDATE,
Expand All @@ -23,7 +25,9 @@ impl ToString for EventStatusType {
match self {
Self::FAILURE => String::from("failure"),
Self::ERROR => String::from("error"),
Self::WARN => String::from("warn"),
Self::WARNING => String::from("warning"),
Self::OK => String::from("ok"),
Self::INFO => String::from("info"),
Self::SUCCESS => String::from("success"),
Self::USER_UPDATE => String::from("user_update"),
Expand Down Expand Up @@ -55,7 +59,9 @@ impl<'de> Deserialize<'de> for EventStatusType {
Ok(match s.as_str() {
"failure" => Self::FAILURE,
"error" => Self::ERROR,
"warn" => Self::WARN,
"warning" => Self::WARNING,
"ok" => Self::OK,
"info" => Self::INFO,
"success" => Self::SUCCESS,
"user_update" => Self::USER_UPDATE,
Expand Down
2 changes: 1 addition & 1 deletion src/datadogV2/model/model_events_request_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct EventsRequestPage {
/// The returned paging point to use to get the next results.
#[serde(rename = "cursor")]
pub cursor: Option<String>,
/// The maximum number of logs in the response.
/// The maximum number of events in the response.
#[serde(rename = "limit")]
pub limit: Option<i32>,
#[serde(flatten)]
Expand Down
Loading