Struct datadog_api_client::datadogV2::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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn main() {
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let response = api.list_events_with_pagination(
ListEventsOptionalParams::default()
.filter_from("now-15m".to_string())
.filter_to("now".to_string())
.page_limit(2),
);
pin_mut!(response);
while let Some(resp) = response.next().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 22 23 24
async fn main() {
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api
.list_events(
ListEventsOptionalParams::default()
.filter_query("datadog-agent".to_string())
.filter_from("2020-09-17T11:48:36+01:00".to_string())
.filter_to("2020-09-17T12:48:36+01:00".to_string())
.page_limit(5),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
async fn main() {
let body = EventsListRequest::new()
.filter(
EventsQueryFilter::new()
.from("2020-09-17T11:48:36+01:00".to_string())
.query("datadog-agent".to_string())
.to("2020-09-17T12:48:36+01:00".to_string()),
)
.page(EventsRequestPage::new().limit(5))
.sort(EventsSort::TIMESTAMP_ASCENDING);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api
.search_events(SearchEventsOptionalParams::default().body(body))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
async fn main() {
let body = EventsListRequest::new()
.filter(
EventsQueryFilter::new()
.from("now-15m".to_string())
.to("now".to_string()),
)
.options(EventsQueryOptions::new().timezone("GMT".to_string()))
.page(EventsRequestPage::new().limit(2))
.sort(EventsSort::TIMESTAMP_ASCENDING);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let response =
api.search_events_with_pagination(SearchEventsOptionalParams::default().body(body));
pin_mut!(response);
while let Some(resp) = response.next().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 list_events(
&self,
params: ListEventsOptionalParams,
) -> Result<EventsListResponse, Error<ListEventsError>>
pub async fn list_events( &self, params: ListEventsOptionalParams, ) -> Result<EventsListResponse, Error<ListEventsError>>
List endpoint returns events that match an events search query. Results are paginated similarly to logs.
Use this endpoint to see your latest events.
Examples found in repository?
More examples
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn main() {
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api
.list_events(
ListEventsOptionalParams::default()
.filter_query("datadog-agent".to_string())
.filter_from("2020-09-17T11:48:36+01:00".to_string())
.filter_to("2020-09-17T12:48:36+01:00".to_string())
.page_limit(5),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn list_events_with_pagination(
&self,
params: ListEventsOptionalParams,
) -> impl Stream<Item = Result<EventResponse, Error<ListEventsError>>> + '_
pub fn list_events_with_pagination( &self, params: ListEventsOptionalParams, ) -> impl Stream<Item = Result<EventResponse, Error<ListEventsError>>> + '_
Examples found in repository?
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn main() {
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let response = api.list_events_with_pagination(
ListEventsOptionalParams::default()
.filter_from("now-15m".to_string())
.filter_to("now".to_string())
.page_limit(2),
);
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}sourcepub async fn list_events_with_http_info(
&self,
params: ListEventsOptionalParams,
) -> Result<ResponseContent<EventsListResponse>, Error<ListEventsError>>
pub async fn list_events_with_http_info( &self, params: ListEventsOptionalParams, ) -> Result<ResponseContent<EventsListResponse>, Error<ListEventsError>>
List endpoint returns events that match an events search query. Results are paginated similarly to logs.
Use this endpoint to see your latest events.
sourcepub async fn search_events(
&self,
params: SearchEventsOptionalParams,
) -> Result<EventsListResponse, Error<SearchEventsError>>
pub async fn search_events( &self, params: SearchEventsOptionalParams, ) -> Result<EventsListResponse, Error<SearchEventsError>>
List endpoint returns events that match an events search query. Results are paginated similarly to logs.
Use this endpoint to build complex events filtering and search.
Examples found in repository?
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
async fn main() {
let body = EventsListRequest::new()
.filter(
EventsQueryFilter::new()
.from("2020-09-17T11:48:36+01:00".to_string())
.query("datadog-agent".to_string())
.to("2020-09-17T12:48:36+01:00".to_string()),
)
.page(EventsRequestPage::new().limit(5))
.sort(EventsSort::TIMESTAMP_ASCENDING);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let resp = api
.search_events(SearchEventsOptionalParams::default().body(body))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn search_events_with_pagination(
&self,
params: SearchEventsOptionalParams,
) -> impl Stream<Item = Result<EventResponse, Error<SearchEventsError>>> + '_
pub fn search_events_with_pagination( &self, params: SearchEventsOptionalParams, ) -> impl Stream<Item = Result<EventResponse, Error<SearchEventsError>>> + '_
Examples found in repository?
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
async fn main() {
let body = EventsListRequest::new()
.filter(
EventsQueryFilter::new()
.from("now-15m".to_string())
.to("now".to_string()),
)
.options(EventsQueryOptions::new().timezone("GMT".to_string()))
.page(EventsRequestPage::new().limit(2))
.sort(EventsSort::TIMESTAMP_ASCENDING);
let configuration = datadog::Configuration::new();
let api = EventsAPI::with_config(configuration);
let response =
api.search_events_with_pagination(SearchEventsOptionalParams::default().body(body));
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}sourcepub async fn search_events_with_http_info(
&self,
params: SearchEventsOptionalParams,
) -> Result<ResponseContent<EventsListResponse>, Error<SearchEventsError>>
pub async fn search_events_with_http_info( &self, params: SearchEventsOptionalParams, ) -> Result<ResponseContent<EventsListResponse>, Error<SearchEventsError>>
List endpoint returns events that match an events search query. Results are paginated similarly to logs.
Use this endpoint to build complex events filtering and search.
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)