Struct datadog_api_client::datadogV1::api::api_events::EventsAPI
source · pub struct EventsAPI { /* private fields */ }Expand description
The Event Management API allows you to programmatically post events to the Events Explorer and fetch events from the Events Explorer. See the Event Management page for more information.
Implementations§
source§impl EventsAPI
impl EventsAPI
pub fn new() -> Self
sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
async fn main() {
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api
.list_events(
9223372036854775807,
9223372036854775807,
ListEventsOptionalParams::default(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}7 8 9 10 11 12 13 14 15 16 17 18
async fn main() {
let body = EventCreateRequest::new("A text message.".to_string(), "Example-Event".to_string())
.tags(vec!["test:ExampleEvent".to_string()]);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api.create_event(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
async fn main() {
let body =
EventCreateRequest::new(
"A text message.".to_string(),
"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters".to_string(),
).tags(vec!["test:ExampleEvent".to_string()]);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api.create_event(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
sourcepub async fn create_event(
&self,
body: EventCreateRequest,
) -> Result<EventCreateResponse, Error<CreateEventError>>
pub async fn create_event( &self, body: EventCreateRequest, ) -> Result<EventCreateResponse, Error<CreateEventError>>
This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events.
Examples found in repository?
7 8 9 10 11 12 13 14 15 16 17 18
async fn main() {
let body = EventCreateRequest::new("A text message.".to_string(), "Example-Event".to_string())
.tags(vec!["test:ExampleEvent".to_string()]);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api.create_event(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}More examples
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
async fn main() {
let body =
EventCreateRequest::new(
"A text message.".to_string(),
"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters".to_string(),
).tags(vec!["test:ExampleEvent".to_string()]);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api.create_event(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn create_event_with_http_info(
&self,
body: EventCreateRequest,
) -> Result<ResponseContent<EventCreateResponse>, Error<CreateEventError>>
pub async fn create_event_with_http_info( &self, body: EventCreateRequest, ) -> Result<ResponseContent<EventCreateResponse>, Error<CreateEventError>>
This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events.
sourcepub async fn get_event(
&self,
event_id: i64,
) -> Result<EventResponse, Error<GetEventError>>
pub async fn get_event( &self, event_id: i64, ) -> Result<EventResponse, Error<GetEventError>>
This endpoint allows you to query for event details.
Note: If the event you’re querying contains markdown formatting of any kind,
you may see characters such as %,\,n in your output.
sourcepub async fn get_event_with_http_info(
&self,
event_id: i64,
) -> Result<ResponseContent<EventResponse>, Error<GetEventError>>
pub async fn get_event_with_http_info( &self, event_id: i64, ) -> Result<ResponseContent<EventResponse>, Error<GetEventError>>
This endpoint allows you to query for event details.
Note: If the event you’re querying contains markdown formatting of any kind,
you may see characters such as %,\,n in your output.
sourcepub async fn list_events(
&self,
start: i64,
end: i64,
params: ListEventsOptionalParams,
) -> Result<EventListResponse, Error<ListEventsError>>
pub async fn list_events( &self, start: i64, end: i64, params: ListEventsOptionalParams, ) -> Result<EventListResponse, Error<ListEventsError>>
The event stream can be queried and filtered by time, priority, sources and tags.
Notes:
-
If the event you’re querying contains markdown formatting of any kind, you may see characters such as
%,\,nin your output. -
This endpoint returns a maximum of
1000most recent results. To return additional results, identify the last timestamp of the last result and set that as theendquery time to paginate the results. You can also use the page parameter to specify which set of1000results to return.
Examples found in repository?
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
async fn main() {
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api
.list_events(
9223372036854775807,
9223372036854775807,
ListEventsOptionalParams::default(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn list_events_with_http_info(
&self,
start: i64,
end: i64,
params: ListEventsOptionalParams,
) -> Result<ResponseContent<EventListResponse>, Error<ListEventsError>>
pub async fn list_events_with_http_info( &self, start: i64, end: i64, params: ListEventsOptionalParams, ) -> Result<ResponseContent<EventListResponse>, Error<ListEventsError>>
The event stream can be queried and filtered by time, priority, sources and tags.
Notes:
-
If the event you’re querying contains markdown formatting of any kind, you may see characters such as
%,\,nin your output. -
This endpoint returns a maximum of
1000most recent results. To return additional results, identify the last timestamp of the last result and set that as theendquery time to paginate the results. You can also use the page parameter to specify which set of1000results to return.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventsAPI
impl !RefUnwindSafe for EventsAPI
impl Send for EventsAPI
impl Sync for EventsAPI
impl Unpin for EventsAPI
impl !UnwindSafe for EventsAPI
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)