pub struct DowntimesAPI { /* private fields */ }
Expand description
Note: Downtime V2 is currently in private beta. To request access, contact Datadog support.
Downtiming gives you greater control over monitor notifications by allowing you to globally exclude scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags.
Implementations§
Source§impl DowntimesAPI
impl DowntimesAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = DowntimesAPI::with_config(configuration);
10 let resp = api
11 .list_downtimes(ListDowntimesOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
More examples
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = DowntimesAPI::with_config(configuration);
10 let resp = api
11 .list_monitor_downtimes(35534610, ListMonitorDowntimesOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
6async fn main() {
7 // there is a valid "downtime_v2" in the system
8 let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = DowntimesAPI::with_config(configuration);
11 let resp = api.cancel_downtime(downtime_v2_data_id.clone()).await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
9async fn main() {
10 let configuration = datadog::Configuration::new();
11 let api = DowntimesAPI::with_config(configuration);
12 let response =
13 api.list_downtimes_with_pagination(ListDowntimesOptionalParams::default().page_limit(2));
14 pin_mut!(response);
15 while let Some(resp) = response.next().await {
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21 }
22}
9async fn main() {
10 let configuration = datadog::Configuration::new();
11 let api = DowntimesAPI::with_config(configuration);
12 let response = api.list_monitor_downtimes_with_pagination(
13 9223372036854775807,
14 ListMonitorDowntimesOptionalParams::default(),
15 );
16 pin_mut!(response);
17 while let Some(resp) = response.next().await {
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23 }
24}
7async fn main() {
8 // there is a valid "downtime_v2" in the system
9 let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = DowntimesAPI::with_config(configuration);
12 let resp = api
13 .get_downtime(
14 downtime_v2_data_id.clone(),
15 GetDowntimeOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn cancel_downtime(
&self,
downtime_id: String,
) -> Result<(), Error<CancelDowntimeError>>
pub async fn cancel_downtime( &self, downtime_id: String, ) -> Result<(), Error<CancelDowntimeError>>
Cancel a downtime.
Note: Downtimes canceled through the API are no longer active, but are retained for approximately two days before being permanently removed. The downtime may still appear in search results until it is permanently removed.
Examples found in repository?
6async fn main() {
7 // there is a valid "downtime_v2" in the system
8 let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = DowntimesAPI::with_config(configuration);
11 let resp = api.cancel_downtime(downtime_v2_data_id.clone()).await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
Sourcepub async fn cancel_downtime_with_http_info(
&self,
downtime_id: String,
) -> Result<ResponseContent<()>, Error<CancelDowntimeError>>
pub async fn cancel_downtime_with_http_info( &self, downtime_id: String, ) -> Result<ResponseContent<()>, Error<CancelDowntimeError>>
Cancel a downtime.
Note: Downtimes canceled through the API are no longer active, but are retained for approximately two days before being permanently removed. The downtime may still appear in search results until it is permanently removed.
Sourcepub async fn create_downtime(
&self,
body: DowntimeCreateRequest,
) -> Result<DowntimeResponse, Error<CreateDowntimeError>>
pub async fn create_downtime( &self, body: DowntimeCreateRequest, ) -> Result<DowntimeResponse, Error<CreateDowntimeError>>
Schedule a downtime.
Examples found in repository?
14async fn main() {
15 let body = DowntimeCreateRequest::new(DowntimeCreateRequestData::new(
16 DowntimeCreateRequestAttributes::new(
17 DowntimeMonitorIdentifier::DowntimeMonitorIdentifierTags(Box::new(
18 DowntimeMonitorIdentifierTags::new(vec!["cat:hat".to_string()]),
19 )),
20 "test:exampledowntime".to_string(),
21 )
22 .message(Some("dark forest".to_string()))
23 .schedule(
24 DowntimeScheduleCreateRequest::DowntimeScheduleOneTimeCreateUpdateRequest(Box::new(
25 DowntimeScheduleOneTimeCreateUpdateRequest::new().start(None),
26 )),
27 ),
28 DowntimeResourceType::DOWNTIME,
29 ));
30 let configuration = datadog::Configuration::new();
31 let api = DowntimesAPI::with_config(configuration);
32 let resp = api.create_downtime(body).await;
33 if let Ok(value) = resp {
34 println!("{:#?}", value);
35 } else {
36 println!("{:#?}", resp.unwrap_err());
37 }
38}
Sourcepub async fn create_downtime_with_http_info(
&self,
body: DowntimeCreateRequest,
) -> Result<ResponseContent<DowntimeResponse>, Error<CreateDowntimeError>>
pub async fn create_downtime_with_http_info( &self, body: DowntimeCreateRequest, ) -> Result<ResponseContent<DowntimeResponse>, Error<CreateDowntimeError>>
Schedule a downtime.
Sourcepub async fn get_downtime(
&self,
downtime_id: String,
params: GetDowntimeOptionalParams,
) -> Result<DowntimeResponse, Error<GetDowntimeError>>
pub async fn get_downtime( &self, downtime_id: String, params: GetDowntimeOptionalParams, ) -> Result<DowntimeResponse, Error<GetDowntimeError>>
Get downtime detail by downtime_id
.
Examples found in repository?
7async fn main() {
8 // there is a valid "downtime_v2" in the system
9 let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = DowntimesAPI::with_config(configuration);
12 let resp = api
13 .get_downtime(
14 downtime_v2_data_id.clone(),
15 GetDowntimeOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn get_downtime_with_http_info(
&self,
downtime_id: String,
params: GetDowntimeOptionalParams,
) -> Result<ResponseContent<DowntimeResponse>, Error<GetDowntimeError>>
pub async fn get_downtime_with_http_info( &self, downtime_id: String, params: GetDowntimeOptionalParams, ) -> Result<ResponseContent<DowntimeResponse>, Error<GetDowntimeError>>
Get downtime detail by downtime_id
.
Sourcepub async fn list_downtimes(
&self,
params: ListDowntimesOptionalParams,
) -> Result<ListDowntimesResponse, Error<ListDowntimesError>>
pub async fn list_downtimes( &self, params: ListDowntimesOptionalParams, ) -> Result<ListDowntimesResponse, Error<ListDowntimesError>>
Get all scheduled downtimes.
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = DowntimesAPI::with_config(configuration);
10 let resp = api
11 .list_downtimes(ListDowntimesOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
Sourcepub fn list_downtimes_with_pagination(
&self,
params: ListDowntimesOptionalParams,
) -> impl Stream<Item = Result<DowntimeResponseData, Error<ListDowntimesError>>> + '_
pub fn list_downtimes_with_pagination( &self, params: ListDowntimesOptionalParams, ) -> impl Stream<Item = Result<DowntimeResponseData, Error<ListDowntimesError>>> + '_
Examples found in repository?
9async fn main() {
10 let configuration = datadog::Configuration::new();
11 let api = DowntimesAPI::with_config(configuration);
12 let response =
13 api.list_downtimes_with_pagination(ListDowntimesOptionalParams::default().page_limit(2));
14 pin_mut!(response);
15 while let Some(resp) = response.next().await {
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21 }
22}
Sourcepub async fn list_downtimes_with_http_info(
&self,
params: ListDowntimesOptionalParams,
) -> Result<ResponseContent<ListDowntimesResponse>, Error<ListDowntimesError>>
pub async fn list_downtimes_with_http_info( &self, params: ListDowntimesOptionalParams, ) -> Result<ResponseContent<ListDowntimesResponse>, Error<ListDowntimesError>>
Get all scheduled downtimes.
Sourcepub async fn list_monitor_downtimes(
&self,
monitor_id: i64,
params: ListMonitorDowntimesOptionalParams,
) -> Result<MonitorDowntimeMatchResponse, Error<ListMonitorDowntimesError>>
pub async fn list_monitor_downtimes( &self, monitor_id: i64, params: ListMonitorDowntimesOptionalParams, ) -> Result<MonitorDowntimeMatchResponse, Error<ListMonitorDowntimesError>>
Get all active downtimes for the specified monitor.
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = DowntimesAPI::with_config(configuration);
10 let resp = api
11 .list_monitor_downtimes(35534610, ListMonitorDowntimesOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
Sourcepub fn list_monitor_downtimes_with_pagination(
&self,
monitor_id: i64,
params: ListMonitorDowntimesOptionalParams,
) -> impl Stream<Item = Result<MonitorDowntimeMatchResponseData, Error<ListMonitorDowntimesError>>> + '_
pub fn list_monitor_downtimes_with_pagination( &self, monitor_id: i64, params: ListMonitorDowntimesOptionalParams, ) -> impl Stream<Item = Result<MonitorDowntimeMatchResponseData, Error<ListMonitorDowntimesError>>> + '_
Examples found in repository?
9async fn main() {
10 let configuration = datadog::Configuration::new();
11 let api = DowntimesAPI::with_config(configuration);
12 let response = api.list_monitor_downtimes_with_pagination(
13 9223372036854775807,
14 ListMonitorDowntimesOptionalParams::default(),
15 );
16 pin_mut!(response);
17 while let Some(resp) = response.next().await {
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23 }
24}
Sourcepub async fn list_monitor_downtimes_with_http_info(
&self,
monitor_id: i64,
params: ListMonitorDowntimesOptionalParams,
) -> Result<ResponseContent<MonitorDowntimeMatchResponse>, Error<ListMonitorDowntimesError>>
pub async fn list_monitor_downtimes_with_http_info( &self, monitor_id: i64, params: ListMonitorDowntimesOptionalParams, ) -> Result<ResponseContent<MonitorDowntimeMatchResponse>, Error<ListMonitorDowntimesError>>
Get all active downtimes for the specified monitor.
Sourcepub async fn update_downtime(
&self,
downtime_id: String,
body: DowntimeUpdateRequest,
) -> Result<DowntimeResponse, Error<UpdateDowntimeError>>
pub async fn update_downtime( &self, downtime_id: String, body: DowntimeUpdateRequest, ) -> Result<DowntimeResponse, Error<UpdateDowntimeError>>
Update a downtime by downtime_id
.
Examples found in repository?
10async fn main() {
11 // there is a valid "downtime_v2" in the system
12 let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
13 let body = DowntimeUpdateRequest::new(DowntimeUpdateRequestData::new(
14 DowntimeUpdateRequestAttributes::new().message(Some("light speed".to_string())),
15 downtime_v2_data_id.clone(),
16 DowntimeResourceType::DOWNTIME,
17 ));
18 let configuration = datadog::Configuration::new();
19 let api = DowntimesAPI::with_config(configuration);
20 let resp = api.update_downtime(downtime_v2_data_id.clone(), body).await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
Sourcepub async fn update_downtime_with_http_info(
&self,
downtime_id: String,
body: DowntimeUpdateRequest,
) -> Result<ResponseContent<DowntimeResponse>, Error<UpdateDowntimeError>>
pub async fn update_downtime_with_http_info( &self, downtime_id: String, body: DowntimeUpdateRequest, ) -> Result<ResponseContent<DowntimeResponse>, Error<UpdateDowntimeError>>
Update a downtime by downtime_id
.
Trait Implementations§
Source§impl Clone for DowntimesAPI
impl Clone for DowntimesAPI
Source§fn clone(&self) -> DowntimesAPI
fn clone(&self) -> DowntimesAPI
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more